[xiph-commits] r7436 - in trunk: . icecast2yp icecast2yp/m4

oddsock at motherfish-iii.xiph.org oddsock
Thu Aug 5 19:05:34 PDT 2004


icecast2yp/sql icecast2yp/src icecast2yp/src/.deps
Message-ID: <E1Bsu6w-0001iK-GX at motherfish-III>

Author: oddsock
Date: Thu Aug  5 19:05:34 2004
New Revision: 7436

Added:
trunk/icecast2yp/
trunk/icecast2yp/Makefile.am
trunk/icecast2yp/README
trunk/icecast2yp/autogen.sh
trunk/icecast2yp/configure.in
trunk/icecast2yp/m4/
trunk/icecast2yp/m4/mysql.m4
trunk/icecast2yp/sql/
trunk/icecast2yp/sql/Makefile.am
trunk/icecast2yp/sql/reset_db.sql
trunk/icecast2yp/src/
trunk/icecast2yp/src/.deps/
trunk/icecast2yp/src/.deps/log.Po
trunk/icecast2yp/src/.deps/xmlconvert.Po
trunk/icecast2yp/src/.deps/yp-cachegen.Po
trunk/icecast2yp/src/.deps/yp-cgi.Po
trunk/icecast2yp/src/.deps/yp-clean.Po
trunk/icecast2yp/src/.deps/yp-random.Po
trunk/icecast2yp/src/.deps/yp-routines.Po
trunk/icecast2yp/src/.deps/yp_cachegen.Po
trunk/icecast2yp/src/.deps/yp_cgi.Po
trunk/icecast2yp/src/.deps/yp_clean.Po
trunk/icecast2yp/src/.deps/yp_random.Po
trunk/icecast2yp/src/.deps/yp_routines.Po
trunk/icecast2yp/src/Makefile.am
trunk/icecast2yp/src/clear_log.c
trunk/icecast2yp/src/iconv_string.c
trunk/icecast2yp/src/iconv_string.h
trunk/icecast2yp/src/log.c
trunk/icecast2yp/src/log.h
trunk/icecast2yp/src/run_cachegen.sh
trunk/icecast2yp/src/yp_cachegen.c
trunk/icecast2yp/src/yp_cgi.c
trunk/icecast2yp/src/yp_clean.c
trunk/icecast2yp/src/yp_db.h
trunk/icecast2yp/src/yp_random.c
trunk/icecast2yp/src/yp_routines.c
trunk/icecast2yp/src/yp_routines.h
Log:
initial commit of the icecast2 YP CGI utilities


Added: trunk/icecast2yp/Makefile.am
===================================================================
--- trunk/icecast2yp/Makefile.am	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/Makefile.am	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,12 @@
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = 1.6 foreign dist-zip
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = src
+
+debug:
+	$(MAKE) all CFLAGS="@DEBUG@"
+
+profile:
+	$(MAKE) all CFLAGS="@PROFILE@"

Added: trunk/icecast2yp/README
===================================================================
--- trunk/icecast2yp/README	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/README	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,13 @@
+The is the readme for the icecast2 yp directory cgi script.
+----------------------------------------------------------
+
+currently this is a work in-progress...
+
+
+Dependencies :
+
+- libxml2
+- mysql client libs
+- libcgi
+
+Please make sure you have these libraries installed before building the code.

Added: trunk/icecast2yp/autogen.sh
===================================================================
--- trunk/icecast2yp/autogen.sh	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/autogen.sh	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,113 @@
+#!/bin/sh
+# Run this to set up the build system: configure, makefiles, etc.
+# (based on the version in enlightenment's cvs)
+
+package="icecast2_yp"
+
+olddir=`pwd`
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+cd "$srcdir"
+DIE=0
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have autoconf installed to compile $package."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+        DIE=1
+}
+VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
+
+# do we need automake?
+if test -r Makefile.am; then
+    echo Checking for automake version
+    options=`fgrep AUTOMAKE_OPTIONS Makefile.am`
+    AM_NEEDED=`echo "$options" | $VERSIONGREP`
+    AM_PROGS=automake
+    AC_PROGS=aclocal
+    if test -n "$AM_NEEDED" && test "x$AM_NEEDED" != "x$options"
+    then
+        AM_PROGS="automake-$AM_NEEDED automake$AM_NEEDED $AM_PROGS"
+        AC_PROGS="aclocal-$AM_NEEDED aclocal$AM_NEEDED $AC_PROGS"
+    else
+        AM_NEEDED=""
+    fi
+    AM_PROGS="$AUTOMAKE $AM_PROGS"
+    AC_PROGS="$ACLOCAL $AC_PROGS"
+    for am in $AM_PROGS; do
+      ($am --version > /dev/null 2>&1) 2>/dev/null || continue
+      ver=`$am --version | head -1 | $VERSIONGREP`
+      AWK_RES=`echo $ver $AM_NEEDED | awk '{ if ( $1 >= $2 ) print "yes"; else print "no" }'`
+      if test "$AWK_RES" = "yes"; then
+        AUTOMAKE=$am
+        echo "  found $AUTOMAKE"
+        break
+      fi
+    done
+    for ac in $AC_PROGS; do
+      ($ac --version > /dev/null 2>&1) 2>/dev/null || continue
+      ver=`$ac --version < /dev/null | head -1 | $VERSIONGREP`
+      AWK_RES=`echo $ver $AM_NEEDED | awk '{ if ( $1 >= $2 ) print "yes"; else print "no" }'`
+      if test "$AWK_RES" = "yes"; then
+        ACLOCAL=$ac
+        echo "  found $ACLOCAL"
+        break
+      fi
+    done
+    test -z $AUTOMAKE || test -z $ACLOCAL && {
+        echo
+        if test -n "$AM_NEEDED"; then
+            echo "You must have automake version $AM_NEEDED installed"
+            echo "to compile $package."
+        else
+            echo "You must have automake installed to compile $package."
+        fi
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+        DIE=1
+      }
+fi
+
+(libtoolize --version)  > /dev/null 2>&1 || {
+	echo
+	echo "You must have libtool installed to compile $package."
+	echo "Download the appropriate package for your system,"
+	echo "or get the source from one of the GNU ftp sites"
+	echo "listed in http://www.gnu.org/order/ftp.html"
+	DIE=1
+}
+
+if test "$DIE" -eq 1; then
+        exit 1
+fi
+
+echo "Generating configuration files for $package, please wait...."
+
+ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
+if test -n "$ACLOCAL"; then
+  echo "  $ACLOCAL $ACLOCAL_FLAGS"
+  $ACLOCAL $ACLOCAL_FLAGS
+fi
+
+echo "  autoheader"
+autoheader
+
+echo "  libtoolize --automake"
+libtoolize --automake
+
+if test -n "$AUTOMAKE"; then
+  echo "  $AUTOMAKE --add-missing"
+  $AUTOMAKE --add-missing
+fi
+
+echo "  autoconf"
+autoconf
+
+if test -z "$*"; then
+        echo "I am going to run ./configure with no arguments - if you wish "
+        echo "to pass any to it, please specify them on the $0 command line."
+fi
+cd $olddir
+$srcdir/configure "$@" && echo


Property changes on: trunk/icecast2yp/autogen.sh
___________________________________________________________________
Name: svn:executable
+

Added: trunk/icecast2yp/configure.in
===================================================================
--- trunk/icecast2yp/configure.in	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/configure.in	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,89 @@
+AC_INIT([icecast2_yp], [0.1.0], [icecast at xiph.org])
+
+AC_CANONICAL_HOST
+AC_PREREQ(2.54)
+AC_CONFIG_SRCDIR(src/yp_cgi.c)
+dnl Process this file with autoconf to produce a configure script.
+
+AM_INIT_AUTOMAKE
+AM_CONFIG_HEADER(config.h)
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+AM_PROG_LIBTOOL
+
+dnl Set some options based on environment
+
+DEBUG="-g"
+if test -z "$GCC"; then
+    XIPH_CPPFLAGS="-D_REENTRANT"
+    case $host in
+        *-*-irix*)
+                XIPH_CPPFLAGS="$XIPH_CPPFLAGS -w -signed"
+                PROFILE="-p -g3 -O2 -signed -D_REENTRANT"
+                ;;
+        *-*-solaris*)
+                XIPH_CFLAGS="-xO4 -xcg92"
+                XIPH_CPPFLAGS="$XIPH_CPPFLAGS -v -w -fsimple -fast"
+                PROFILE="-xpg -g -Dsuncc"
+                ;;
+        *)
+                XIPH_CFLAGS="-O"
+                PROFILE="-g -p"
+                ;;
+    esac
+
+    case "$host" in
+        *openbsd* | *irix*)
+        ;;
+        *) AC_DEFINE([_XOPEN_SOURCE], 600, [Define if you have POSIX and XPG specifications])
+        ;;
+    esac
+
+else
+    XIPH_CPPFLAGS="-Wall -ffast-math -fsigned-char"
+    PROFILE="-pg -g"
+    AC_DEFINE([_GNU_SOURCE], 1, [Define to include GNU extensions to POSIX])
+fi
+
+dnl Checks for programs.
+
+dnl Checks for libraries.
+
+dnl Checks for header files.
+AC_HEADER_STDC
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+
+dnl Check for types
+
+dnl Checks for library functions.
+
+dnl -- configure options --
+
+AM_PATH_MYSQL(, , AC_MSG_ERROR(Cannot find mysql client library))
+AM_PATH_XML2(, , AC_MSG_ERROR(Cannot find libxml2))
+
+#CFLAGS="$CFLAGS -I${prefix}/include"
+#LIBS="-L${prefix}/lib $LIBS -lcgi"
+#AC_CHECK_HEADERS(cgi.h,CFLAGS="$CFLAGS -I${prefix}/include" LIBS="-L${prefix}/lib $LIBS -lcgi",AC_MSG_ERROR(Cannot find libcgi))
+OLDCFLAGS=${CFLAGS}
+OLDCPPFLAGS=${CPPFLAGS}
+CFLAGS="${CFLAGS} -I$prefix/include"
+CPPFLAGS="${CPPFLAGS} -I$prefix/include"
+AC_CHECK_HEADERS(cgi.h,,AC_MSG_ERROR(Cannot find libcgi))
+CPPFLAGS=${OLDCPPFLAGS}
+CFLAGS=${OLDCFLAGS}
+
+
+LIBS="-L/usr/local/lib $LIBS -lcgi"
+
+dnl Make substitutions
+
+AC_SUBST(LIBTOOL_DEPS)
+AC_SUBST(LIBS)
+AC_SUBST(DEBUG)
+AC_SUBST(CFLAGS)
+AC_SUBST(PROFILE)
+
+AC_OUTPUT([Makefile src/Makefile sql/Makefile])

Added: trunk/icecast2yp/m4/mysql.m4
===================================================================
--- trunk/icecast2yp/m4/mysql.m4	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/m4/mysql.m4	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,46 @@
+# =========================================================================
+# AM_PATH_MYSQL : MySQL library
+
+dnl AM_PATH_MYSQL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for MYSQL, and define MYSQL_CFLAGS and MYSQL_LIBS
+dnl
+AC_DEFUN(AM_PATH_MYSQL,
+[dnl
+dnl Get the cflags and libraries from the mysql_config script
+dnl
+AC_ARG_WITH(mysql-prefix,[  --with-mysql-prefix=PFX   Prefix where MYSQL is installed (optional)],
+            mysql_prefix="$withval", mysql_prefix="")
+AC_ARG_WITH(mysql-exec-prefix,[  --with-mysql-exec-prefix=PFX Exec prefix where MYSQL is installed (optional)],
+            mysql_exec_prefix="$withval", mysql_exec_prefix="")
+
+  if test x$mysql_exec_prefix != x ; then
+     mysql_args="$mysql_args --exec-prefix=$mysql_exec_prefix"
+     if test x${MYSQL_CONFIG+set} != xset ; then
+        MYSQL_CONFIG=$mysql_exec_prefix/bin/mysql_config
+     fi
+  fi
+  if test x$mysql_prefix != x ; then
+     mysql_args="$mysql_args --prefix=$mysql_prefix"
+     if test x${MYSQL_CONFIG+set} != xset ; then
+        MYSQL_CONFIG=$mysql_prefix/bin/mysql_config
+     fi
+  fi
+
+  AC_REQUIRE([AC_CANONICAL_TARGET])
+  AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no)
+  AC_MSG_CHECKING(for MYSQL)
+  no_mysql=""
+  if test "$MYSQL_CONFIG" = "no" ; then
+    MYSQL_CFLAGS=""
+    MYSQL_LIBS=""
+    AC_MSG_RESULT(no)
+     ifelse([$2], , :, [$2])
+  else
+    MYSQL_CFLAGS=`$MYSQL_CONFIG $mysqlconf_args --cflags | sed -e "s/'//g"`
+    MYSQL_LIBS=`$MYSQL_CONFIG $mysqlconf_args --libs | sed -e "s/'//g"`
+    AC_MSG_RESULT(yes)
+    ifelse([$1], , :, [$1])
+  fi
+  AC_SUBST(MYSQL_CFLAGS)
+  AC_SUBST(MYSQL_LIBS)
+])

Added: trunk/icecast2yp/sql/Makefile.am
===================================================================
--- trunk/icecast2yp/sql/Makefile.am	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/sql/Makefile.am	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,6 @@
+## Process this with automake to create Makefile.in
+
+AUTOMAKE_OPTIONS = foreign
+
+EXTRA_DIST= reset_db.sql
+

Added: trunk/icecast2yp/sql/reset_db.sql
===================================================================
--- trunk/icecast2yp/sql/reset_db.sql	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/sql/reset_db.sql	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,71 @@
+use oddsock;
+drop table listens;
+drop table server_details;
+drop table servers;
+drop table servers_touch;
+
+-- MySQL dump 9.08
+--
+-- Host: localhost    Database: oddsock
+---------------------------------------------------------
+-- Server version	4.0.13-log
+
+--
+-- Table structure for table 'listens'
+--
+
+CREATE TABLE listens (
+  listen_ip varchar(25) default NULL,
+  server_name varchar(100) default NULL,
+  listen_time timestamp(14) NOT NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'server_details'
+--
+
+CREATE TABLE server_details (
+  id mediumint(9) NOT NULL auto_increment,
+  parent_id mediumint(9) default NULL,
+  server_name varchar(100) default NULL,
+  listing_ip varchar(25) default NULL,
+  description varchar(255) default NULL,
+  genre varchar(100) default NULL,
+  sid varchar(200) default NULL,
+  cluster_password varchar(50) default NULL,
+  url varchar(255) default NULL,
+  current_song varchar(255) default NULL,
+  listen_url varchar(200) default NULL,
+  server_type varchar(25) default NULL,
+  bitrate varchar(25) default NULL,
+  listeners int(11) default NULL,
+  channels varchar(25) default NULL,
+  samplerate varchar(25) default NULL,
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'servers'
+--
+
+CREATE TABLE servers (
+  id mediumint(9) NOT NULL auto_increment,
+  server_name varchar(100) default NULL,
+  listing_ip varchar(25) default NULL,
+  listeners int(11) default NULL,
+  rank int(11) default NULL,
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table 'servers_touch'
+--
+
+CREATE TABLE servers_touch (
+  id varchar(200) NOT NULL default '',
+  server_name varchar(100) default NULL,
+  listing_ip varchar(25) default NULL,
+  last_touch datetime default NULL,
+  PRIMARY KEY  (id)
+) TYPE=MyISAM;
+

Added: trunk/icecast2yp/src/.deps/log.Po
===================================================================
--- trunk/icecast2yp/src/.deps/log.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/log.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,85 @@
+log.o: log.c /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h \
+  /usr/include/bits/types.h /usr/include/bits/wordsize.h \
+  /usr/include/bits/typesizes.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
+  /usr/include/gconv.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h \
+  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+  /usr/include/bits/stdio.h /usr/include/stdlib.h \
+  /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
+  /usr/include/bits/endian.h /usr/include/sys/select.h \
+  /usr/include/bits/select.h /usr/include/bits/sigset.h \
+  /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
+  /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+  /usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
+  /usr/include/bits/string2.h log.h
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/bits/stdio.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+/usr/include/string.h:
+
+/usr/include/bits/string.h:
+
+/usr/include/bits/string2.h:
+
+log.h:

Added: trunk/icecast2yp/src/.deps/xmlconvert.Po
===================================================================
--- trunk/icecast2yp/src/.deps/xmlconvert.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/xmlconvert.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,144 @@
+xmlconvert.o: xmlconvert.c /usr/include/string.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h \
+  /usr/include/bits/string.h /usr/include/bits/string2.h \
+  /usr/include/endian.h /usr/include/bits/endian.h \
+  /usr/include/bits/types.h /usr/include/bits/wordsize.h \
+  /usr/include/bits/typesizes.h /usr/include/stdlib.h \
+  /usr/include/libxml2/libxml/parser.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h \
+  /usr/include/libxml2/libxml/xmlversion.h \
+  /usr/include/libxml2/libxml/xmlexports.h \
+  /usr/include/libxml2/libxml/tree.h /usr/include/stdio.h \
+  /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
+  /usr/include/bits/wchar.h /usr/include/gconv.h \
+  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+  /usr/include/bits/stdio.h /usr/include/libxml2/libxml/xmlstring.h \
+  /usr/include/libxml2/libxml/xmlregexp.h \
+  /usr/include/libxml2/libxml/dict.h /usr/include/libxml2/libxml/hash.h \
+  /usr/include/libxml2/libxml/valid.h \
+  /usr/include/libxml2/libxml/xmlerror.h \
+  /usr/include/libxml2/libxml/list.h \
+  /usr/include/libxml2/libxml/xmlautomata.h \
+  /usr/include/libxml2/libxml/entities.h \
+  /usr/include/libxml2/libxml/encoding.h /usr/include/iconv.h \
+  /usr/include/libxml2/libxml/xmlIO.h \
+  /usr/include/libxml2/libxml/globals.h /usr/include/libxml2/libxml/SAX.h \
+  /usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \
+  /usr/include/bits/select.h /usr/include/bits/sigset.h \
+  /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
+  /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+  /usr/include/alloca.h /usr/include/libxml2/libxml/xlink.h \
+  /usr/include/libxml2/libxml/SAX2.h \
+  /usr/include/libxml2/libxml/xmlmemory.h \
+  /usr/include/libxml2/libxml/threads.h
+
+/usr/include/string.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h:
+
+/usr/include/bits/string.h:
+
+/usr/include/bits/string2.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/libxml2/libxml/parser.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h:
+
+/usr/include/libxml2/libxml/xmlversion.h:
+
+/usr/include/libxml2/libxml/xmlexports.h:
+
+/usr/include/libxml2/libxml/tree.h:
+
+/usr/include/stdio.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/bits/stdio.h:
+
+/usr/include/libxml2/libxml/xmlstring.h:
+
+/usr/include/libxml2/libxml/xmlregexp.h:
+
+/usr/include/libxml2/libxml/dict.h:
+
+/usr/include/libxml2/libxml/hash.h:
+
+/usr/include/libxml2/libxml/valid.h:
+
+/usr/include/libxml2/libxml/xmlerror.h:
+
+/usr/include/libxml2/libxml/list.h:
+
+/usr/include/libxml2/libxml/xmlautomata.h:
+
+/usr/include/libxml2/libxml/entities.h:
+
+/usr/include/libxml2/libxml/encoding.h:
+
+/usr/include/iconv.h:
+
+/usr/include/libxml2/libxml/xmlIO.h:
+
+/usr/include/libxml2/libxml/globals.h:
+
+/usr/include/libxml2/libxml/SAX.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+/usr/include/libxml2/libxml/xlink.h:
+
+/usr/include/libxml2/libxml/SAX2.h:
+
+/usr/include/libxml2/libxml/xmlmemory.h:
+
+/usr/include/libxml2/libxml/threads.h:

Added: trunk/icecast2yp/src/.deps/yp-cachegen.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp-cachegen.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp-cachegen.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1 @@
+# dummy

Added: trunk/icecast2yp/src/.deps/yp-cgi.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp-cgi.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp-cgi.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,108 @@
+yp-cgi.o: yp-cgi.c yp-routines.h /usr/include/stdio.h \
+  /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/gnu/stubs.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h \
+  /usr/include/bits/types.h /usr/include/bits/wordsize.h \
+  /usr/include/bits/typesizes.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
+  /usr/include/gconv.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h \
+  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+  /usr/include/bits/stdio.h /usr/include/stdlib.h \
+  /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
+  /usr/include/bits/endian.h /usr/include/sys/select.h \
+  /usr/include/bits/select.h /usr/include/bits/sigset.h \
+  /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
+  /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+  /usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
+  /usr/include/bits/string2.h /usr/include/mysql/mysql.h \
+  /usr/include/mysql/mysql_com.h /usr/include/mysql/mysql_version.h \
+  /usr/local/include/cgi.h /usr/include/unistd.h \
+  /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
+  /usr/include/getopt.h log.h
+
+yp-routines.h:
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/bits/stdio.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+/usr/include/string.h:
+
+/usr/include/bits/string.h:
+
+/usr/include/bits/string2.h:
+
+/usr/include/mysql/mysql.h:
+
+/usr/include/mysql/mysql_com.h:
+
+/usr/include/mysql/mysql_version.h:
+
+/usr/local/include/cgi.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+log.h:

Added: trunk/icecast2yp/src/.deps/yp-clean.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp-clean.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp-clean.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1 @@
+# dummy

Added: trunk/icecast2yp/src/.deps/yp-random.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp-random.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp-random.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1 @@
+# dummy

Added: trunk/icecast2yp/src/.deps/yp-routines.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp-routines.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp-routines.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,110 @@
+yp-routines.o: yp-routines.c yp-routines.h /usr/include/stdio.h \
+  /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/gnu/stubs.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h \
+  /usr/include/bits/types.h /usr/include/bits/wordsize.h \
+  /usr/include/bits/typesizes.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
+  /usr/include/gconv.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h \
+  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+  /usr/include/bits/stdio.h /usr/include/stdlib.h \
+  /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
+  /usr/include/bits/endian.h /usr/include/sys/select.h \
+  /usr/include/bits/select.h /usr/include/bits/sigset.h \
+  /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
+  /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+  /usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
+  /usr/include/bits/string2.h /usr/include/mysql/mysql.h \
+  /usr/include/mysql/mysql_com.h /usr/include/mysql/mysql_version.h \
+  /usr/local/include/cgi.h /usr/include/unistd.h \
+  /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
+  /usr/include/getopt.h log.h yp-db.h
+
+yp-routines.h:
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/bits/stdio.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+/usr/include/string.h:
+
+/usr/include/bits/string.h:
+
+/usr/include/bits/string2.h:
+
+/usr/include/mysql/mysql.h:
+
+/usr/include/mysql/mysql_com.h:
+
+/usr/include/mysql/mysql_version.h:
+
+/usr/local/include/cgi.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+log.h:
+
+yp-db.h:

Added: trunk/icecast2yp/src/.deps/yp_cachegen.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp_cachegen.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp_cachegen.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,164 @@
+yp_cachegen.o: yp_cachegen.c /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h \
+  /usr/include/bits/types.h /usr/include/bits/wordsize.h \
+  /usr/include/bits/typesizes.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
+  /usr/include/gconv.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h \
+  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+  /usr/include/bits/stdio.h /usr/include/stdlib.h \
+  /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
+  /usr/include/bits/endian.h /usr/include/sys/select.h \
+  /usr/include/bits/select.h /usr/include/bits/sigset.h \
+  /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
+  /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+  /usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
+  /usr/include/bits/string2.h /usr/include/mysql/mysql.h \
+  /usr/include/mysql/mysql_com.h /usr/include/mysql/mysql_version.h \
+  /usr/include/unistd.h /usr/include/bits/posix_opt.h \
+  /usr/include/bits/confname.h /usr/include/getopt.h \
+  /usr/include/libxml2/libxml/xmlmemory.h \
+  /usr/include/libxml2/libxml/xmlversion.h \
+  /usr/include/libxml2/libxml/xmlexports.h \
+  /usr/include/libxml2/libxml/threads.h \
+  /usr/include/libxml2/libxml/globals.h \
+  /usr/include/libxml2/libxml/parser.h /usr/include/libxml2/libxml/tree.h \
+  /usr/include/libxml2/libxml/xmlstring.h \
+  /usr/include/libxml2/libxml/xmlregexp.h \
+  /usr/include/libxml2/libxml/dict.h /usr/include/libxml2/libxml/hash.h \
+  /usr/include/libxml2/libxml/valid.h \
+  /usr/include/libxml2/libxml/xmlerror.h \
+  /usr/include/libxml2/libxml/list.h \
+  /usr/include/libxml2/libxml/xmlautomata.h \
+  /usr/include/libxml2/libxml/entities.h \
+  /usr/include/libxml2/libxml/encoding.h /usr/include/iconv.h \
+  /usr/include/libxml2/libxml/xmlIO.h /usr/include/libxml2/libxml/SAX.h \
+  /usr/include/libxml2/libxml/xlink.h /usr/include/libxml2/libxml/SAX2.h \
+  log.h
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/bits/stdio.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+/usr/include/string.h:
+
+/usr/include/bits/string.h:
+
+/usr/include/bits/string2.h:
+
+/usr/include/mysql/mysql.h:
+
+/usr/include/mysql/mysql_com.h:
+
+/usr/include/mysql/mysql_version.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+/usr/include/libxml2/libxml/xmlmemory.h:
+
+/usr/include/libxml2/libxml/xmlversion.h:
+
+/usr/include/libxml2/libxml/xmlexports.h:
+
+/usr/include/libxml2/libxml/threads.h:
+
+/usr/include/libxml2/libxml/globals.h:
+
+/usr/include/libxml2/libxml/parser.h:
+
+/usr/include/libxml2/libxml/tree.h:
+
+/usr/include/libxml2/libxml/xmlstring.h:
+
+/usr/include/libxml2/libxml/xmlregexp.h:
+
+/usr/include/libxml2/libxml/dict.h:
+
+/usr/include/libxml2/libxml/hash.h:
+
+/usr/include/libxml2/libxml/valid.h:
+
+/usr/include/libxml2/libxml/xmlerror.h:
+
+/usr/include/libxml2/libxml/list.h:
+
+/usr/include/libxml2/libxml/xmlautomata.h:
+
+/usr/include/libxml2/libxml/entities.h:
+
+/usr/include/libxml2/libxml/encoding.h:
+
+/usr/include/iconv.h:
+
+/usr/include/libxml2/libxml/xmlIO.h:
+
+/usr/include/libxml2/libxml/SAX.h:
+
+/usr/include/libxml2/libxml/xlink.h:
+
+/usr/include/libxml2/libxml/SAX2.h:
+
+log.h:

Added: trunk/icecast2yp/src/.deps/yp_cgi.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp_cgi.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp_cgi.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,108 @@
+yp_cgi.o: yp_cgi.c yp_routines.h /usr/include/stdio.h \
+  /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/gnu/stubs.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h \
+  /usr/include/bits/types.h /usr/include/bits/wordsize.h \
+  /usr/include/bits/typesizes.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
+  /usr/include/gconv.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h \
+  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+  /usr/include/bits/stdio.h /usr/include/stdlib.h \
+  /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
+  /usr/include/bits/endian.h /usr/include/sys/select.h \
+  /usr/include/bits/select.h /usr/include/bits/sigset.h \
+  /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
+  /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+  /usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
+  /usr/include/bits/string2.h /usr/include/mysql/mysql.h \
+  /usr/include/mysql/mysql_com.h /usr/include/mysql/mysql_version.h \
+  /usr/local/include/cgi.h /usr/include/unistd.h \
+  /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
+  /usr/include/getopt.h log.h
+
+yp_routines.h:
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/bits/stdio.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+/usr/include/string.h:
+
+/usr/include/bits/string.h:
+
+/usr/include/bits/string2.h:
+
+/usr/include/mysql/mysql.h:
+
+/usr/include/mysql/mysql_com.h:
+
+/usr/include/mysql/mysql_version.h:
+
+/usr/local/include/cgi.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+log.h:

Added: trunk/icecast2yp/src/.deps/yp_clean.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp_clean.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp_clean.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,102 @@
+yp_clean.o: yp_clean.c /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h \
+  /usr/include/bits/types.h /usr/include/bits/wordsize.h \
+  /usr/include/bits/typesizes.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
+  /usr/include/gconv.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h \
+  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+  /usr/include/bits/stdio.h /usr/include/stdlib.h \
+  /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
+  /usr/include/bits/endian.h /usr/include/sys/select.h \
+  /usr/include/bits/select.h /usr/include/bits/sigset.h \
+  /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
+  /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+  /usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
+  /usr/include/bits/string2.h /usr/include/mysql/mysql.h \
+  /usr/include/mysql/mysql_com.h /usr/include/mysql/mysql_version.h \
+  /usr/include/unistd.h /usr/include/bits/posix_opt.h \
+  /usr/include/bits/confname.h /usr/include/getopt.h log.h
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/bits/stdio.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+/usr/include/string.h:
+
+/usr/include/bits/string.h:
+
+/usr/include/bits/string2.h:
+
+/usr/include/mysql/mysql.h:
+
+/usr/include/mysql/mysql_com.h:
+
+/usr/include/mysql/mysql_version.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+log.h:

Added: trunk/icecast2yp/src/.deps/yp_random.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp_random.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp_random.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,102 @@
+yp_random.o: yp_random.c /usr/include/stdio.h /usr/include/features.h \
+  /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h \
+  /usr/include/bits/types.h /usr/include/bits/wordsize.h \
+  /usr/include/bits/typesizes.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
+  /usr/include/gconv.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h \
+  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+  /usr/include/bits/stdio.h /usr/include/stdlib.h \
+  /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
+  /usr/include/bits/endian.h /usr/include/sys/select.h \
+  /usr/include/bits/select.h /usr/include/bits/sigset.h \
+  /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
+  /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+  /usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
+  /usr/include/bits/string2.h /usr/include/mysql/mysql.h \
+  /usr/include/mysql/mysql_com.h /usr/include/mysql/mysql_version.h \
+  /usr/include/unistd.h /usr/include/bits/posix_opt.h \
+  /usr/include/bits/confname.h /usr/include/getopt.h log.h
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/bits/stdio.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+/usr/include/string.h:
+
+/usr/include/bits/string.h:
+
+/usr/include/bits/string2.h:
+
+/usr/include/mysql/mysql.h:
+
+/usr/include/mysql/mysql_com.h:
+
+/usr/include/mysql/mysql_version.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+log.h:

Added: trunk/icecast2yp/src/.deps/yp_routines.Po
===================================================================
--- trunk/icecast2yp/src/.deps/yp_routines.Po	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/.deps/yp_routines.Po	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,110 @@
+yp_routines.o: yp_routines.c yp_routines.h /usr/include/stdio.h \
+  /usr/include/features.h /usr/include/sys/cdefs.h \
+  /usr/include/gnu/stubs.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h \
+  /usr/include/bits/types.h /usr/include/bits/wordsize.h \
+  /usr/include/bits/typesizes.h /usr/include/libio.h \
+  /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
+  /usr/include/gconv.h \
+  /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h \
+  /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
+  /usr/include/bits/stdio.h /usr/include/stdlib.h \
+  /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \
+  /usr/include/bits/endian.h /usr/include/sys/select.h \
+  /usr/include/bits/select.h /usr/include/bits/sigset.h \
+  /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
+  /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
+  /usr/include/alloca.h /usr/include/string.h /usr/include/bits/string.h \
+  /usr/include/bits/string2.h /usr/include/mysql/mysql.h \
+  /usr/include/mysql/mysql_com.h /usr/include/mysql/mysql_version.h \
+  /usr/local/include/cgi.h /usr/include/unistd.h \
+  /usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
+  /usr/include/getopt.h log.h yp_db.h
+
+yp_routines.h:
+
+/usr/include/stdio.h:
+
+/usr/include/features.h:
+
+/usr/include/sys/cdefs.h:
+
+/usr/include/gnu/stubs.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stddef.h:
+
+/usr/include/bits/types.h:
+
+/usr/include/bits/wordsize.h:
+
+/usr/include/bits/typesizes.h:
+
+/usr/include/libio.h:
+
+/usr/include/_G_config.h:
+
+/usr/include/wchar.h:
+
+/usr/include/bits/wchar.h:
+
+/usr/include/gconv.h:
+
+/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include/stdarg.h:
+
+/usr/include/bits/stdio_lim.h:
+
+/usr/include/bits/sys_errlist.h:
+
+/usr/include/bits/stdio.h:
+
+/usr/include/stdlib.h:
+
+/usr/include/sys/types.h:
+
+/usr/include/time.h:
+
+/usr/include/endian.h:
+
+/usr/include/bits/endian.h:
+
+/usr/include/sys/select.h:
+
+/usr/include/bits/select.h:
+
+/usr/include/bits/sigset.h:
+
+/usr/include/bits/time.h:
+
+/usr/include/sys/sysmacros.h:
+
+/usr/include/bits/pthreadtypes.h:
+
+/usr/include/bits/sched.h:
+
+/usr/include/alloca.h:
+
+/usr/include/string.h:
+
+/usr/include/bits/string.h:
+
+/usr/include/bits/string2.h:
+
+/usr/include/mysql/mysql.h:
+
+/usr/include/mysql/mysql_com.h:
+
+/usr/include/mysql/mysql_version.h:
+
+/usr/local/include/cgi.h:
+
+/usr/include/unistd.h:
+
+/usr/include/bits/posix_opt.h:
+
+/usr/include/bits/confname.h:
+
+/usr/include/getopt.h:
+
+log.h:
+
+yp_db.h:

Added: trunk/icecast2yp/src/Makefile.am
===================================================================
--- trunk/icecast2yp/src/Makefile.am	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/Makefile.am	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,25 @@
+## Process this with automake to create Makefile.in
+
+AUTOMAKE_OPTIONS = foreign
+
+EXTRA_DIST= iconv_string.h log.h yp_db.h yp_routines.h run_cachegen.sh
+
+bin_PROGRAMS = yp_cgi yp_cachegen yp_clean yp_random
+
+
+yp_cgi_SOURCES = yp_cgi.c log.c yp_routines.c
+yp_cachegen_SOURCES = yp_cachegen.c log.c yp_routines.c
+yp_clean_SOURCES = yp_clean.c log.c yp_routines.c
+yp_random_SOURCES = yp_random.c log.c yp_routines.c
+
+CFLAGS = @CFLAGS@ @MYSQL_CFLAGS@ @XML_CFLAGS@ -I${prefix}/include
+CPPFLAGS = @CPPFLAGS@ @MYSQL_CFLAGS@ @XML_CFLAGS@ -I${prefix}/include
+LIBS = @LIBS@ @MYSQL_LIBS@ @XML_LIBS@ -L${prefix}/lib
+
+
+debug:
+	$(MAKE) all CFLAGS="@DEBUG@"
+
+profile:
+	$(MAKE) all CFLAGS="@PROFILE@"
+

Added: trunk/icecast2yp/src/clear_log.c
===================================================================
--- trunk/icecast2yp/src/clear_log.c	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/clear_log.c	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,9 @@
+#include <stdio.h>
+main()
+{
+	FILE *filep;
+
+	filep = fopen(YP_LOGDIR"yp_cgi.log", "w");
+	fclose(filep);
+	exit(0);
+}

Added: trunk/icecast2yp/src/iconv_string.c
===================================================================
--- trunk/icecast2yp/src/iconv_string.c	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/iconv_string.c	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,154 @@
+/* Copyright (C) 1999-2001, 2003 Bruno Haible.
+   This file is not part of the GNU LIBICONV Library.
+   This file is put into the public domain.  */
+
+#include "iconv_string.h"
+#include <iconv.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define tmpbufsize 4096
+
+int iconv_string (const char* tocode, const char* fromcode,
+                  const char* start, const char* end,
+                  char** resultp, size_t* lengthp)
+{
+  iconv_t cd = iconv_open(tocode,fromcode);
+  size_t length;
+  char* result;
+  if (cd == (iconv_t)(-1)) {
+    if (errno != EINVAL)
+      return -1;
+    /* Unsupported fromcode or tocode. Check whether the caller requested
+       autodetection. */
+    if (!strcmp(fromcode,"autodetect_utf8")) {
+      int ret;
+      /* Try UTF-8 first. There are very few ISO-8859-1 inputs that would
+         be valid UTF-8, but many UTF-8 inputs are valid ISO-8859-1. */
+      ret = iconv_string(tocode,"UTF-8",start,end,resultp,lengthp);
+      if (!(ret < 0 && errno == EILSEQ))
+        return ret;
+      ret = iconv_string(tocode,"ISO-8859-1",start,end,resultp,lengthp);
+      return ret;
+    }
+    if (!strcmp(fromcode,"autodetect_jp")) {
+      int ret;
+      /* Try 7-bit encoding first. If the input contains bytes >= 0x80,
+         it will fail. */
+      ret = iconv_string(tocode,"ISO-2022-JP-2",start,end,resultp,lengthp);
+      if (!(ret < 0 && errno == EILSEQ))
+        return ret;
+      /* Try EUC-JP next. Short SHIFT_JIS inputs may come out wrong. This
+         is unavoidable. People will condemn SHIFT_JIS.
+         If we tried SHIFT_JIS first, then some short EUC-JP inputs would
+         come out wrong, and people would condemn EUC-JP and Unix, which
+         would not be good. */
+      ret = iconv_string(tocode,"EUC-JP",start,end,resultp,lengthp);
+      if (!(ret < 0 && errno == EILSEQ))
+        return ret;
+      /* Finally try SHIFT_JIS. */
+      ret = iconv_string(tocode,"SHIFT_JIS",start,end,resultp,lengthp);
+      return ret;
+    }
+    if (!strcmp(fromcode,"autodetect_kr")) {
+      int ret;
+      /* Try 7-bit encoding first. If the input contains bytes >= 0x80,
+         it will fail. */
+      ret = iconv_string(tocode,"ISO-2022-KR",start,end,resultp,lengthp);
+      if (!(ret < 0 && errno == EILSEQ))
+        return ret;
+      /* Finally try EUC-KR. */
+      ret = iconv_string(tocode,"EUC-KR",start,end,resultp,lengthp);
+      return ret;
+    }
+    errno = EINVAL;
+    return -1;
+  }
+  /* Determine the length we need. */
+  {
+    size_t count = 0;
+    char tmpbuf[tmpbufsize];
+    const char* inptr = start;
+    size_t insize = end-start;
+    while (insize > 0) {
+      char* outptr = tmpbuf;
+      size_t outsize = tmpbufsize;
+      size_t res = iconv(cd,&inptr,&insize,&outptr,&outsize);
+      if (res == (size_t)(-1) && errno != E2BIG) {
+        if (errno == EINVAL)
+          break;
+        else {
+          int saved_errno = errno;
+          iconv_close(cd);
+          errno = saved_errno;
+          return -1;
+        }
+      }
+      count += outptr-tmpbuf;
+    }
+    {
+      char* outptr = tmpbuf;
+      size_t outsize = tmpbufsize;
+      size_t res = iconv(cd,NULL,NULL,&outptr,&outsize);
+      if (res == (size_t)(-1)) {
+        int saved_errno = errno;
+        iconv_close(cd);
+        errno = saved_errno;
+        return -1;
+      }
+      count += outptr-tmpbuf;
+    }
+    length = count;
+  }
+  if (lengthp != NULL)
+    *lengthp = length;
+  if (resultp == NULL) {
+    iconv_close(cd);
+    return 0;
+  }
+  result = (*resultp == NULL ? malloc(length) : realloc(*resultp,length));
+  *resultp = result;
+  if (length == 0) {
+    iconv_close(cd);
+    return 0;
+  }
+  if (result == NULL) {
+    iconv_close(cd);
+    errno = ENOMEM;
+    return -1;
+  }
+  iconv(cd,NULL,NULL,NULL,NULL); /* return to the initial state */
+  /* Do the conversion for real. */
+  {
+    const char* inptr = start;
+    size_t insize = end-start;
+    char* outptr = result;
+    size_t outsize = length;
+    while (insize > 0) {
+      size_t res = iconv(cd,&inptr,&insize,&outptr,&outsize);
+      if (res == (size_t)(-1)) {
+        if (errno == EINVAL)
+          break;
+        else {
+          int saved_errno = errno;
+          iconv_close(cd);
+          errno = saved_errno;
+          return -1;
+        }
+      }
+    }
+    {
+      size_t res = iconv(cd,NULL,NULL,&outptr,&outsize);
+      if (res == (size_t)(-1)) {
+        int saved_errno = errno;
+        iconv_close(cd);
+        errno = saved_errno;
+        return -1;
+      }
+    }
+    if (outsize != 0) abort();
+  }
+  iconv_close(cd);
+  return 0;
+}

Added: trunk/icecast2yp/src/iconv_string.h
===================================================================
--- trunk/icecast2yp/src/iconv_string.h	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/iconv_string.h	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,47 @@
+/* Copyright (C) 1999-2001 Bruno Haible.
+   This file is not part of the GNU LIBICONV Library.
+   This file is put into the public domain.  */
+
+/*
+ * This C function converts an entire string from one encoding to another,
+ * using iconv. Easier to use than iconv() itself, and supports autodetect
+ * encodings on input.
+ *
+ *   int iconv_string (const char* tocode, const char* fromcode,
+ *                     const char* start, const char* end,
+ *                     char** resultp, size_t* lengthp)
+ *
+ * Converts a memory region given in encoding FROMCODE to a new memory
+ * region in encoding TOCODE. FROMCODE and TOCODE are as for iconv_open(3),
+ * except that FROMCODE may be one of the values
+ *    "autodetect_utf8"          supports ISO-8859-1 and UTF-8
+ *    "autodetect_jp"            supports EUC-JP, ISO-2022-JP-2 and SHIFT_JIS
+ *    "autodetect_kr"            supports EUC-KR and ISO-2022-KR
+ * The input is in the memory region between start (inclusive) and end
+ * (exclusive). If resultp is not NULL, the output string is stored in
+ * *resultp; malloc/realloc is used to allocate the result.
+ *
+ * This function does not treat zero characters specially.
+ *
+ * Return value: 0 if successful, otherwise -1 and errno set. Particular
+ * errno values: EILSEQ and ENOMEM.
+ *
+ * Example:
+ *   const char* s = ...;
+ *   char* result = NULL;
+ *   if (iconv_string("UCS-4-INTERNAL", "autodetect_utf8",
+ *                    s, s+strlen(s)+1, &result, NULL) < 0)
+ *     perror("iconv_string");
+ *
+ */
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int iconv_string (const char* tocode, const char* fromcode, const char* start, const char* end, char** resultp, size_t* lengthp);
+
+#ifdef __cplusplus
+}
+#endif

Added: trunk/icecast2yp/src/log.c
===================================================================
--- trunk/icecast2yp/src/log.c	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/log.c	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,100 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <time.h>
+#include "log.h"
+
+static	int	globalErrorType = LM_DEBUG;
+static	char	gLogFile[1024] = "yp_clean.log";
+static	FILE	*filep = 0;
+static	char	logSid[1024] = "";
+static  char	logIP[255] = "";
+
+void setErrorType(int type) {
+	globalErrorType = type;
+}
+
+void setLogSid(char *sid) {
+	memset(logSid, '\000', sizeof(logSid));
+	strncpy(logSid, sid, sizeof(logSid)-1);
+}
+void setLogIP(char *ip) {
+	memset(logIP, '\000', sizeof(logIP));
+	strncpy(logIP, ip, sizeof(logIP)-1);
+}
+void setLogFile(char *file) {
+	if (file) {
+		strcpy(gLogFile, file);
+	}
+}
+void closeLog() {
+	if (filep) {
+		fclose(filep);
+	}
+}
+void LogMessage(int type, char *source, int line, char *fmt, ...) {
+	va_list parms;
+	char	errortype[25] = "";
+	int	addNewline = 1;
+	struct tm *tp;
+	long t;
+	int parseableOutput = 0;
+	char    timeStamp[255];
+
+	memset(timeStamp, '\000', sizeof(timeStamp));
+
+	time(&t);
+	tp = localtime(&t);
+	strftime(timeStamp, sizeof(timeStamp), "%m/%d/%y %T", tp);
+
+	switch (type) {
+		case LM_ERROR:
+			strcpy(errortype, "Error");
+			break;
+		case LM_INFO:
+			strcpy(errortype, "Info");
+			break;
+		case LM_DEBUG:
+			strcpy(errortype, "Debug");
+			break;
+		default:
+			strcpy(errortype, "Unknown");
+			break;
+	}
+
+	if (fmt[strlen(fmt)-1] == '\n') {
+		addNewline = 0;
+	}
+
+
+	if (type <= globalErrorType) {
+		va_start(parms, fmt);
+
+		if (filep == 0) {
+			filep = fopen(gLogFile, "a");
+		}
+
+		if (!filep) {
+			fprintf(stdout, "Cannot open logfile: %s(%s:%d): ", errortype, source, line);
+			vfprintf(stdout, fmt, parms);
+			va_end(parms);
+			if (addNewline) {
+				fprintf(stdout, "\n");
+			}
+		}
+		else {
+			fprintf(filep,  "%s sid(%s) ip(%s) %s(%s:%d): ", timeStamp, logSid, logIP, errortype, source, line);
+			vfprintf(filep, fmt, parms);
+			va_end(parms);
+			if (addNewline) {
+				fprintf(filep, "\n");
+			}
+			fflush(filep);
+			//fclose(filep);
+		}
+
+	}
+
+}
+

Added: trunk/icecast2yp/src/log.h
===================================================================
--- trunk/icecast2yp/src/log.h	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/log.h	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,28 @@
+#ifndef __TRANSLOG_H__
+#define __TRANSLOG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void LogMessage(int type, char *source, int line, char *fmt, ...);
+void setErrorType(int type);
+void setLogFile(char *file);
+void setLogSid(char *sid);
+void setLogIP(char *sid);
+#ifdef __cplusplus
+}
+#endif
+
+#define LM_FORCE 0
+#define LM_ERROR 1
+#define LM_INFO 2
+#define LM_DEBUG 3
+#define LOG_FORCE LM_FORCE, __FILE__, __LINE__
+#define LOG_ERROR LM_ERROR, __FILE__, __LINE__
+#define LOG_INFO LM_INFO, __FILE__, __LINE__
+#define LOG_DEBUG LM_DEBUG, __FILE__, __LINE__
+#define Log	LogMessage
+
+#define YP_LOGDIR "./"
+
+#endif

Added: trunk/icecast2yp/src/run_cachegen.sh
===================================================================
--- trunk/icecast2yp/src/run_cachegen.sh	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/run_cachegen.sh	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,8 @@
+#!/bin/sh
+PID=`pidof yp-cachegen`
+if [ ! -z "$PID" ]
+then
+	echo "Already runnning!"
+	exit
+fi
+/home/oddsock/bin/yp_cachegen


Property changes on: trunk/icecast2yp/src/run_cachegen.sh
___________________________________________________________________
Name: svn:executable
+

Added: trunk/icecast2yp/src/yp_cachegen.c
===================================================================
--- trunk/icecast2yp/src/yp_cachegen.c	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/yp_cachegen.c	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,174 @@
+/*********************************************
+YP-CACHEGEN by oddsock
+**********************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mysql.h>
+#include <unistd.h>
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include "log.h"
+
+
+extern MYSQL		dbase;
+MYSQL_RES	*result;
+MYSQL_RES	*result2;
+
+#define ERROR -1
+#define SUCCESS 1
+
+unsigned char*
+convert (unsigned char *in, char *encoding)
+{
+	unsigned char *out;
+        int ret,size,out_size,temp;
+        xmlCharEncodingHandlerPtr handler;
+
+        size = (int)strlen(in)+1;
+        out_size = size*2-1;
+        out = malloc((size_t)out_size);
+
+        if (out) {
+                handler = xmlFindCharEncodingHandler(encoding);
+
+                if (!handler) {
+                        free(out);
+                        out = NULL;
+                }
+        }
+        if (out) {
+                temp=size-1;
+                ret = handler->input(out, &out_size, in, &temp);
+                if (ret || temp-size+1) {
+                        if (ret) {
+                                printf("conversion wasn't successful.\n");
+                        } else {
+                                printf("conversion wasn't successful. converted: %i octets.\n",temp);
+                        }
+                        free(out);
+                        out = NULL;
+                } else {
+                        out = realloc(out,out_size+1);
+                        out[out_size]=0; /*null terminating out*/
+
+                }
+        } else {
+                printf("no mem\n");
+        }
+        return (out);
+}
+
+
+int gen_cache(char *error)
+{
+	char	sql[8096];
+	char	sid[2046];
+	int	i;
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+        char    detail_id[255] = "";
+        char    parent_id[255] = "";
+	char	*p1;
+	int	randomNumber = 0;
+	char *encoding = "ISO-8859-1";
+
+	xmlDocPtr doc;
+	xmlNodePtr rootNode;
+	xmlNodePtr entryNode;
+
+	doc = xmlNewDoc("1.0");
+	rootNode = xmlNewDocNode(doc, NULL, "directory", NULL);
+	xmlDocSetRootElement(doc, rootNode);
+
+
+	srand(time() + getpid());
+
+	memset(sql, '\000', sizeof(sql));
+
+	sprintf(sql,"select a.server_name, b.listen_url, b.server_type, b.bitrate, b.channels, b.samplerate, b.genre, b.current_song from servers a, server_details b where a.id = b.parent_id order by server_name");
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		return(ERROR);
+	}
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+	if(nrows == 0) {
+		return(SUCCESS);
+	}
+	else {
+		for (i=0;i<nrows;i++) {
+			row = mysql_fetch_row(result);
+			if (row[0]) {
+				unsigned char *out0;
+				unsigned char *out1;
+				unsigned char *out2;
+				unsigned char *out3;
+				unsigned char *out4;
+				unsigned char *out5;
+				unsigned char *out6;
+				unsigned char *out7;
+
+				entryNode = xmlNewChild(rootNode, NULL, "entry", NULL);
+				out0 = convert(row[0], encoding);
+				out1 = convert(row[1], encoding);
+				out2 = convert(row[2], encoding);
+				out3 = convert(row[3], encoding);
+				out4 = convert(row[4], encoding);
+				out5 = convert(row[5], encoding);
+				out6 = convert(row[6], encoding);
+				out7 = convert(row[7], encoding);
+
+				xmlNewTextChild(entryNode, NULL, "server_name", out0);
+				xmlNewTextChild(entryNode, NULL, "listen_url", out1);
+				xmlNewTextChild(entryNode, NULL, "server_type", out2);
+				xmlNewTextChild(entryNode, NULL, "bitrate", out3);
+				xmlNewTextChild(entryNode, NULL, "channels", out4);
+				xmlNewTextChild(entryNode, NULL, "samplerate", out5);
+				xmlNewTextChild(entryNode, NULL, "genre", out6);
+				xmlNewTextChild(entryNode, NULL, "current_song", out7);
+				free(out0);
+				free(out1);
+				free(out2);
+				free(out3);
+				free(out4);
+				free(out5);
+				free(out6);
+				free(out7);
+			}
+		}
+		mysql_free_result(result);
+	}
+	xmlSaveFormatFileEnc("yp.xml", doc, encoding, 1);
+	return(SUCCESS);
+}
+
+int main(int argc, char * argv[])
+{
+	int res;
+	int	ret = 0;
+	int	ok = 0;
+	int	pid = 0;
+	char	error[2046];
+	int	loop = 1;
+
+	memset(error, '\000', sizeof(error));
+
+	setErrorType(LM_INFO);
+	setLogFile(YP_LOGDIR"yp-cachegen.log");
+
+	if (connectToDB()) {
+		ret = gen_cache(error);
+		if (ret == ERROR) {
+			LogMessage(LOG_ERROR, "Error: %s", error);
+		}
+	}
+	else {
+		LogMessage(LOG_ERROR, "Cannot connect to DB!");
+	}
+	return(0);
+}
+
+

Added: trunk/icecast2yp/src/yp_cgi.c
===================================================================
--- trunk/icecast2yp/src/yp_cgi.c	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/yp_cgi.c	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,414 @@
+/*********************************************
+YP-CGI by oddsock
+**********************************************/
+#include "yp_routines.h"
+
+
+int main(int argc, char * argv[])
+{
+	int res;
+	int	ret = 0;
+	int	ok = 0;
+	int	action = NO_ACTION;
+	char	error[2046];
+	char	listing_ip[255];
+	char	server_name[101];
+	char	server_type[26];
+	char	bitrate[26];
+	char	desc[256];
+	char	st[256];
+	char	genre[101];
+	char	sid[101];
+	char	cluster_password[51];
+	char	url[256];
+	char	current_song[256];
+	char	listenurl[201];
+	char	listenurl2[201];
+	char	listeners[256];
+	char	samplerate[256];
+	char	channels[256];
+	char	msg[1024];
+	char *p1 = 0;
+	int	use_listingIP = 0;
+
+
+	setErrorType(LM_INFO);
+	setLogFile(YP_LOGDIR"yp_cgi.log");
+	memset(error, '\000', sizeof(error));
+	memset(listing_ip, '\000', sizeof(listing_ip));
+	memset(server_name, '\000', sizeof(server_name));
+	memset(server_type, '\000', sizeof(server_type));
+	memset(bitrate, '\000', sizeof(bitrate));
+	memset(desc, '\000', sizeof(desc));
+	memset(genre, '\000', sizeof(genre));
+	memset(sid, '\000', sizeof(sid));
+	memset(cluster_password, '\000', sizeof(cluster_password));
+	memset(url, '\000', sizeof(url));
+	memset(current_song, '\000', sizeof(current_song));
+	memset(listenurl, '\000', sizeof(listenurl));
+	memset(listenurl2, '\000', sizeof(listenurl2));
+	memset(listeners, '\000', sizeof(listeners));
+	memset(samplerate, '\000', sizeof(samplerate));
+	memset(channels, '\000', sizeof(channels));
+	memset(msg, '\000', sizeof(msg));
+
+	Log(LOG_DEBUG, "Starting execution");
+	if (getenv("REMOTE_ADDR")) {
+		strcpy(listing_ip, getenv("REMOTE_ADDR"));
+	}
+	setLogIP(listing_ip);
+	cgi_init();
+	cgi_process_form();
+
+	//sendOK();
+
+	/* Was there an error initializing the CGI??? */
+/*
+
+	if (res != CGIERR_NONE) {
+		sprintf(msg, "Error # %d: %s<p>\n", res, cgi_strerror(res));
+		sendYPResponse(0, msg, ICECAST2_RESPONSE);
+	}
+*/
+	res = connectToDB();
+	if (!res) {
+		sendYPResponse(0, "Error connecting to database", ICECAST2_RESPONSE);
+		goto endofcall;
+	}
+
+	Log(LOG_DEBUG, "Connected to DB");
+	/* Grab some fields from an HTML form and display them: */
+
+	if (cgi_param("action") != NULL) {
+		if (!strncmp(cgi_param("action"), "add", strlen("add"))) {
+			action = ADD;
+			ok = 1;
+		}
+		if (!strncmp(cgi_param("action"), "touch", strlen("touch"))) {
+			action = TOUCH;
+			ok = 1;
+		}
+		if (!strncmp(cgi_param("action"), "remove", strlen("remove"))) {
+			action = REMOVE;
+			ok = 1;
+		}
+	}
+	if (action == NO_ACTION) {
+		sendYPResponse(0, "No action specified", ICECAST2_RESPONSE);
+		ok = 0;
+	}
+	Log(LOG_DEBUG, "Action = %d - OK = %d", action, ok);
+	if (ok) {
+		char	*ptmp = NULL;
+		if (cgi_param("sn") != NULL) {
+			//printf("<li>Server Name : %s\n", cgi_param("sn"));
+			Log(LOG_DEBUG, "Getting Server Name");
+			ptmp = cgi_unescape_special_chars(cgi_param("sn"));
+			if (ptmp) {
+				strncpy(server_name, ptmp, sizeof(server_name)-1);
+				free(ptmp);
+			}
+
+		}
+		if (cgi_param("genre") != NULL) {
+			Log(LOG_DEBUG, "Getting Genre");
+			//printf("<li>Genre : %s\n", cgi_param("genre"));
+			ptmp = cgi_unescape_special_chars(cgi_param("genre"));
+			if (ptmp) {
+				strncpy(genre, ptmp, sizeof(genre)-1);
+				free(ptmp);
+			}
+		}
+		if (cgi_param("cpswd") != NULL) {
+			//printf("<li>Cluster Password : %s\n", cgi_param("cpswd"));
+			Log(LOG_DEBUG, "Getting Cluster Password");
+			ptmp = cgi_unescape_special_chars(cgi_param("cpswd"));
+			if (ptmp) {
+				strncpy(cluster_password, ptmp, sizeof(cluster_password)-1);
+				free(ptmp);
+			}
+		}
+		if (cgi_param("desc") != NULL) {
+			//printf("<li>Decription : %s\n", cgi_param("desc"));
+			Log(LOG_DEBUG, "Getting Desc");
+			ptmp = cgi_unescape_special_chars(cgi_param("desc"));
+			if (ptmp) {
+				strncpy(desc, cgi_param("desc"), sizeof(desc)-1);
+				free(ptmp);
+			}
+		}
+		if (cgi_param("url") != NULL) {
+			Log(LOG_DEBUG, "Getting URL");
+			//printf("<li>URL : %s\n", cgi_param("url"));
+			ptmp = cgi_unescape_special_chars(cgi_param("url"));
+			if (ptmp) {
+				strncpy(url, ptmp, sizeof(url)-1);
+				free(ptmp);
+			}
+		}
+		if (cgi_param("listenurl") != NULL) {
+			//printf("<li>Listen URL : %s\n", cgi_param("listenurl"));
+			Log(LOG_DEBUG, "Getting Listen URL");
+			if (strlen(cgi_param("listenurl")) > 0) {
+				ptmp = cgi_unescape_special_chars(cgi_param("listenurl"));
+				if (ptmp) {
+					strncpy(listenurl, ptmp, sizeof(listenurl)-1);
+					if (!strncmp(listenurl, "http://localhost", strlen("http://localhost"))) {
+						p1 = listenurl + strlen("http://localhost");
+						use_listingIP = 1;
+					}
+					if (!strncmp(listenurl, "http://192.168.", strlen("http://192.168."))) {
+						p1 = listenurl + strlen("http://192.168.");
+						p1 = strchr(p1, ':');
+						use_listingIP = 1;
+					}
+					if (use_listingIP) {
+						if (p1) {
+							snprintf(listenurl2, sizeof(listenurl2)-1, "http://%s%s", listing_ip, p1);
+							strcpy(listenurl, listenurl2);
+						}
+					}
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("type") != NULL) {
+			Log(LOG_DEBUG, "Getting Server Type");
+			if (strlen(cgi_param("type")) > 0) {
+				ptmp = cgi_unescape_special_chars(cgi_param("type"));
+				if (ptmp) {
+					strncpy(server_type, ptmp, sizeof(server_type)-1);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("b") != NULL) {
+			Log(LOG_DEBUG, "Getting Bitrate");
+			if (strlen(cgi_param("b")) > 0) {
+				ptmp = cgi_unescape_special_chars(cgi_param("b"));
+				if (ptmp) {
+					strncpy(bitrate, ptmp, sizeof(bitrate)-1);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("ice-bitrate") != NULL) {
+			Log(LOG_DEBUG, "Getting Bitrate");
+			if (strlen(cgi_param("ice-bitrate")) > 0) {
+				memset(bitrate, '\000', sizeof(bitrate));
+				ptmp = cgi_unescape_special_chars(cgi_param("ice-bitrate"));
+				if (ptmp) {
+					strncpy(bitrate, ptmp, sizeof(bitrate)-1);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("ice-quality") != NULL) {
+			Log(LOG_DEBUG, "Getting Quality");
+			if (strlen(cgi_param("ice-quality")) > 0) {
+				memset(bitrate, '\000', sizeof(bitrate));
+				ptmp = cgi_unescape_special_chars(cgi_param("ice-quality"));
+				if (ptmp) {
+					snprintf(bitrate, sizeof(bitrate)-1, "Quality %s", ptmp);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("ice-samplerate") != NULL) {
+			Log(LOG_DEBUG, "Getting Samplerate");
+			if (strlen(cgi_param("ice-samplerate")) > 0) {
+				ptmp = cgi_unescape_special_chars(cgi_param("ice-samplerate"));
+				if (ptmp) {
+					strncpy(samplerate, ptmp, sizeof(samplerate)-1);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("ice-channels") != NULL) {
+			Log(LOG_DEBUG, "Getting Channels");
+			if (strlen(cgi_param("ice-channels")) > 0) {
+				ptmp = cgi_unescape_special_chars(cgi_param("ice-channels"));
+				if (ptmp) {
+					strncpy(channels, ptmp, sizeof(channels)-1);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("bitrate") != NULL) {
+			Log(LOG_DEBUG, "Getting Bitrate");
+			if (strlen(cgi_param("bitrate")) > 0) {
+				memset(bitrate, '\000', sizeof(bitrate));
+				ptmp = cgi_unescape_special_chars(cgi_param("bitrate"));
+				if (ptmp) {
+					strncpy(bitrate, ptmp, sizeof(bitrate)-1);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("quality") != NULL) {
+			Log(LOG_DEBUG, "Getting Quality");
+			if (strlen(cgi_param("quality")) > 0) {
+				memset(bitrate, '\000', sizeof(bitrate));
+				Log(LOG_DEBUG, "Quality = (%s)", cgi_param("quality"));
+				ptmp = cgi_unescape_special_chars(cgi_param("quality"));
+				Log(LOG_DEBUG, "Quality = (%s)", ptmp);
+				if (ptmp) {
+					snprintf(bitrate, sizeof(bitrate)-1, "Quality %s", ptmp);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("samplerate") != NULL) {
+			Log(LOG_DEBUG, "Getting Samplerate");
+			if (strlen(cgi_param("samplerate")) > 0) {
+				ptmp = cgi_unescape_special_chars(cgi_param("samplerate"));
+				if (ptmp) {
+					strncpy(samplerate, ptmp, sizeof(samplerate)-1);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("channels") != NULL) {
+			Log(LOG_DEBUG, "Getting Channels");
+			if (strlen(cgi_param("channels")) > 0) {
+				ptmp = cgi_unescape_special_chars(cgi_param("channels"));
+				if (ptmp) {
+					strncpy(channels, ptmp, sizeof(channels)-1);
+					free(ptmp);
+				}
+			}
+		}
+		if (cgi_param("sid") != NULL) {
+			Log(LOG_DEBUG, "Getting SID");
+			ptmp = cgi_unescape_special_chars(cgi_param("sid"));
+			if (ptmp) {
+				strncpy(sid, ptmp, sizeof(sid)-1);
+				free(ptmp);
+			}
+			setLogSid(sid);
+		}
+		if (cgi_param("st") != NULL) {
+			Log(LOG_DEBUG, "Getting Song Title");
+			ptmp = cgi_unescape_special_chars(cgi_param("st"));
+			if (ptmp) {
+				strncpy(st, ptmp, sizeof(st)-1);
+				free(ptmp);
+			}
+		}
+		if (cgi_param("listeners") != NULL) {
+			Log(LOG_DEBUG, "Getting Listeners");
+			ptmp = cgi_unescape_special_chars(cgi_param("listeners"));
+			if (ptmp) {
+				strncpy(listeners, ptmp, sizeof(listeners)-1);
+				free(ptmp);
+			}
+		}
+		Log(LOG_DEBUG, "Done getting parameters");
+		if (action == ADD) {
+			Log(LOG_DEBUG, "Checking server name");
+			if (strlen(server_name) == 0) {
+				sendYPResponse(0, "Server name blank", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			Log(LOG_DEBUG, "Checking Genre");
+			if (strlen(genre) == 0) {
+				sendYPResponse(0, "Genre blank", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			Log(LOG_DEBUG, "Checking Desc");
+			if (strlen(desc) == 0) {
+				strcpy(desc, server_name);
+			}
+			Log(LOG_DEBUG, "Checking listen URL");
+			if (strlen(listenurl) == 0) {
+				sendYPResponse(0, "Listen URL blank", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			Log(LOG_DEBUG, "Checking Server Type");
+			if (strlen(server_type) == 0) {
+				sendYPResponse(0, "Server Type blank", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			Log(LOG_DEBUG, "Checking Bitrate");
+			if (strlen(bitrate) == 0) {
+				strcpy(bitrate, "NA");
+			}
+			Log(LOG_DEBUG, "Going to Add Server");
+			memset(sid, '\000', sizeof(sid));
+			ret = addServer(server_name, genre, cluster_password, desc, url, listenurl, server_type, bitrate, listing_ip, sid, samplerate, channels, error);
+			Log(LOG_DEBUG, "Done With Add Server");
+			if (ret == YP_ADDED) {
+				Log(LOG_DEBUG, "sending sid  of %s", sid);
+				Log(LOG_INFO, "YP_ADD sid of %s", sid);
+				printf("SID: %s\r\nTouchFreq: 60\r\n", sid);
+				sendYPResponse(1, "Successfull Add", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			if (ret == YP_EXISTS) {
+				Log(LOG_DEBUG, "Server Exists (%s)", server_name);
+				Log(LOG_INFO, "YP_ADD failed (Server exists) %s", server_name);
+				sendYPResponse(0, "Server already exists", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			if (ret == YP_ERROR) {
+				Log(LOG_INFO, "YP_ADD failed error of %s", error);
+				sendYPResponse(0, error, ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+		}
+		if (action == TOUCH) {
+			if (strlen(sid) == 0) {
+				Log(LOG_INFO, "YP_TOUCH failed SID blank");
+				sendYPResponse(0, "SID blank", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			ret = touchServer(sid, listing_ip, cluster_password, st, listeners, "", "", "", "", "", "", error, NORMAL_TOUCH);
+			if (ret == YP_TOUCHED) {
+				Log(LOG_INFO, "YP_TOUCH successfull sid (%s)", sid);
+				sendYPResponse(1, "Successfull Touch", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			if (ret == YP_EXISTS) {
+				Log(LOG_DEBUG, "Server Exists (%s)", server_name);
+				Log(LOG_INFO, "YP_TOUCH failed server exists ?!?!? (%s)", server_name);
+				sendYPResponse(0, "Server already exists", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			if (ret == YP_ERROR) {
+				Log(LOG_INFO, "YP_TOUCH failed error of %s", error);
+				sendYPResponse(0, error, ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+		}
+		if (action == REMOVE) {
+			if (strlen(sid) == 0) {
+				Log(LOG_INFO, "YP_REMOVE failed SID blank");
+				sendYPResponse(0, "SID blank", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			ret = removeServer(sid, listing_ip, cluster_password, error);
+			if (ret == YP_TOUCHED) {
+				Log(LOG_INFO, "YP_REMOVE successfull sid (%s)", sid);
+				sendYPResponse(1, "Successfull Remove", ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+			if (ret == YP_ERROR) {
+				Log(LOG_INFO, "YP_REMOVE failed error of %s", error);
+				sendYPResponse(0, error, ICECAST2_RESPONSE);
+				goto endofcall;
+			}
+		}
+	}
+	endofcall:
+
+	cgi_end();
+
+	Log(LOG_DEBUG, "Disconnecting from DB");
+	disconnectFromDB();
+
+	Log(LOG_DEBUG, "Ending execution");
+
+	return(0);
+}
+
+

Added: trunk/icecast2yp/src/yp_clean.c
===================================================================
--- trunk/icecast2yp/src/yp_clean.c	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/yp_clean.c	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,375 @@
+/*********************************************
+YP-CLEAN by oddsock
+**********************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mysql.h>
+#include <unistd.h>
+#include "log.h"
+
+
+extern MYSQL		dbase;
+MYSQL_RES	*result;
+MYSQL_RES	*result2;
+
+#define YP_ERROR 0
+#define YP_SUCCESS 1
+
+
+int cleanServers2(char *error)
+{
+	char	sql[8096];
+	char	sid[2046];
+	int	i;
+	MYSQL_ROW	row;
+	MYSQL_ROW	row2;
+	int	existing = 0;
+	int	nrows = 0;
+	int	nrows2 = 0;
+
+	memset(sql, '\000', sizeof(sql));
+
+	sprintf(sql,"SELECT id FROM servers");
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		return(YP_ERROR);
+	}
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+	if(nrows == 0) {
+		return(YP_SUCCESS);
+	}
+	else {
+		for (i=0;i<nrows;i++) {
+			row = mysql_fetch_row(result);
+			if (row[0]) {
+				sprintf(sql,"SELECT count(*) FROM server_details where parent_id = %s", row[0]);
+				if(mysql_real_query(&dbase,sql,strlen(sql))) {
+					strcpy(error, mysql_error(&dbase));
+					return(YP_ERROR);
+				}
+				result2 = mysql_store_result(&dbase);
+				nrows2 = mysql_num_rows(result2);
+				if(nrows2 != 0) {
+					row2 = mysql_fetch_row(result2);
+					if (row2[0]) {
+						if (atoi(row2[0]) == 0) {
+							sprintf(sql,"delete from servers where id = '%s'", row[0]);
+							if (mysql_real_query(&dbase,sql,strlen(sql))) {
+								sprintf(error, "servers: %s", mysql_error(&dbase));
+								sprintf(sql,"ROLLBACK");
+								mysql_real_query(&dbase,sql,strlen(sql));
+								mysql_free_result(result);
+								mysql_free_result(result2);
+								return(YP_ERROR);
+							}
+							LogMessage(LOG_INFO, "ID (%s) removed from servers due to something being whacked", row[0]);
+						}
+					}
+				}
+				mysql_free_result(result2);
+			}
+		}
+		mysql_free_result(result);
+		sprintf(sql,"COMMIT");
+		mysql_real_query(&dbase,sql,strlen(sql));
+	}
+	return(YP_SUCCESS);
+
+}
+int cleanServers3(char *error)
+{
+	char	sql[8096];
+	char	sid[2046];
+	int	i;
+	MYSQL_ROW	row;
+	MYSQL_ROW	row2;
+	int	existing = 0;
+	int	nrows = 0;
+	int	nrows2 = 0;
+        char    detail_id[255] = "";
+        char    parent_id[255] = "";
+	char	*p1 = NULL;
+
+	memset(sql, '\000', sizeof(sql));
+
+	sprintf(sql,"SELECT id FROM servers_touch");
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		return(YP_ERROR);
+	}
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+	if(nrows == 0) {
+		return(YP_SUCCESS);
+	}
+	else {
+		for (i=0;i<nrows;i++) {
+			row = mysql_fetch_row(result);
+			if (row[0]) {
+				memset(parent_id, '\000', sizeof(parent_id));
+				memset(detail_id, '\000', sizeof(detail_id));
+				p1 = strchr(row[0], '-');
+				if (p1) {
+					strncpy(parent_id, row[0], p1-row[0]);
+					strcpy(detail_id, p1+1);
+				}
+				sprintf(sql,"SELECT count(*) FROM servers where id = %s", parent_id);
+				if(mysql_real_query(&dbase,sql,strlen(sql))) {
+					strcpy(error, mysql_error(&dbase));
+					return(YP_ERROR);
+				}
+				result2 = mysql_store_result(&dbase);
+				nrows2 = mysql_num_rows(result2);
+				if(nrows2 != 0) {
+					row2 = mysql_fetch_row(result2);
+					if (row2[0]) {
+						if (atoi(row2[0]) == 0) {
+							sprintf(sql,"delete from servers_touch where id = '%s'", row[0]);
+							if (mysql_real_query(&dbase,sql,strlen(sql))) {
+								sprintf(error, "servers: %s", mysql_error(&dbase));
+								sprintf(sql,"ROLLBACK");
+								mysql_real_query(&dbase,sql,strlen(sql));
+								mysql_free_result(result);
+								mysql_free_result(result2);
+								return(YP_ERROR);
+							}
+							sprintf(sql,"delete from server_details where parent_id = %s", parent_id);
+							if (mysql_real_query(&dbase,sql,strlen(sql))) {
+								sprintf(error, "servers: %s", mysql_error(&dbase));
+								sprintf(sql,"ROLLBACK");
+								mysql_real_query(&dbase,sql,strlen(sql));
+								mysql_free_result(result);
+								mysql_free_result(result2);
+								return(YP_ERROR);
+							}
+							LogMessage(LOG_INFO, "ID (%s) removed from servers due to something being whacked", row[0]);
+						}
+					}
+				}
+				mysql_free_result(result2);
+			}
+		}
+		mysql_free_result(result);
+		sprintf(sql,"COMMIT");
+		mysql_real_query(&dbase,sql,strlen(sql));
+	}
+	return(YP_SUCCESS);
+
+}
+int cleanServers4(char *error)
+{
+	char	sql[8096];
+	char	sid[2046];
+	int	i;
+	MYSQL_ROW	row;
+	MYSQL_ROW	row2;
+	int	existing = 0;
+	int	nrows = 0;
+	int	nrows2 = 0;
+        char    detail_id[255] = "";
+        char    parent_id[255] = "";
+        char    id[255] = "";
+	char	*p1 = NULL;
+
+	memset(sql, '\000', sizeof(sql));
+
+	sprintf(sql,"SELECT id, parent_id FROM server_details");
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		return(YP_ERROR);
+	}
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+	if(nrows == 0) {
+		return(YP_SUCCESS);
+	}
+	else {
+		for (i=0;i<nrows;i++) {
+			row = mysql_fetch_row(result);
+			if (row[0]) {
+				sprintf(id, "%s-%s", row[1], row[0]);
+				sprintf(sql,"SELECT count(*) FROM servers_touch where id = '%s'", id);
+				if(mysql_real_query(&dbase,sql,strlen(sql))) {
+					strcpy(error, mysql_error(&dbase));
+					return(YP_ERROR);
+				}
+				result2 = mysql_store_result(&dbase);
+				nrows2 = mysql_num_rows(result2);
+				if(nrows2 != 0) {
+					row2 = mysql_fetch_row(result2);
+					if (row2[0]) {
+						if (atoi(row2[0]) == 0) {
+							sprintf(sql,"delete from server_details where id = '%s'", row[0]);
+							if (mysql_real_query(&dbase,sql,strlen(sql))) {
+								sprintf(error, "servers: %s", mysql_error(&dbase));
+								sprintf(sql,"ROLLBACK");
+								mysql_real_query(&dbase,sql,strlen(sql));
+								mysql_free_result(result);
+								mysql_free_result(result2);
+								return(YP_ERROR);
+							}
+							LogMessage(LOG_INFO, "Server Details (%s)(%s) because it didn't have a record (%s) in servers_touch", row[0], row[1], id);
+						}
+					}
+				}
+				mysql_free_result(result2);
+				sprintf(sql,"SELECT count(*) FROM servers where id = %s", row[1]);
+				if(mysql_real_query(&dbase,sql,strlen(sql))) {
+					strcpy(error, mysql_error(&dbase));
+					return(YP_ERROR);
+				}
+				result2 = mysql_store_result(&dbase);
+				nrows2 = mysql_num_rows(result2);
+				if(nrows2 != 0) {
+					row2 = mysql_fetch_row(result2);
+					if (row2[0]) {
+						if (atoi(row2[0]) == 0) {
+							sprintf(sql,"delete from server_details where id = '%s'", row[0]);
+							if (mysql_real_query(&dbase,sql,strlen(sql))) {
+								sprintf(error, "servers: %s", mysql_error(&dbase));
+								sprintf(sql,"ROLLBACK");
+								mysql_real_query(&dbase,sql,strlen(sql));
+								mysql_free_result(result);
+								mysql_free_result(result2);
+								return(YP_ERROR);
+							}
+							LogMessage(LOG_INFO, "ID (%s) removed from server_details due to something being whacked", row[0]);
+						}
+					}
+				}
+				mysql_free_result(result2);
+			}
+		}
+		mysql_free_result(result);
+		sprintf(sql,"COMMIT");
+		mysql_real_query(&dbase,sql,strlen(sql));
+	}
+	return(YP_SUCCESS);
+
+}
+
+int cleanServers(char *error)
+{
+	char	sql[8096];
+	char	sid[2046];
+	int	i;
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+        char    detail_id[255] = "";
+        char    parent_id[255] = "";
+	char	*p1;
+
+
+	memset(sql, '\000', sizeof(sql));
+
+	sprintf(sql,"select id from servers_touch where last_touch < NOW() - INTERVAL 5 MINUTE");
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		return(YP_ERROR);
+	}
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+	if(nrows == 0) {
+		return(YP_SUCCESS);
+	}
+	else {
+		for (i=0;i<nrows;i++) {
+			row = mysql_fetch_row(result);
+			if (row[0]) {
+				memset(parent_id, '\000', sizeof(parent_id));
+				memset(detail_id, '\000', sizeof(detail_id));
+				p1 = strchr(row[0], '-');
+				if (p1) {
+					strncpy(parent_id, row[0], p1-row[0]);
+					strcpy(detail_id, p1+1);
+				}
+
+				sprintf(sql,"delete from server_details where id = '%s'", detail_id);
+				if (mysql_real_query(&dbase,sql,strlen(sql))) {
+					sprintf(error, "servers: %s", mysql_error(&dbase));
+					sprintf(sql,"ROLLBACK");
+					mysql_real_query(&dbase,sql,strlen(sql));
+					mysql_free_result(result);
+					return(YP_ERROR);
+				}
+				Log(LOG_DEBUG, "Check to see if there are any server details for parentid %s", parent_id);
+				if (!anyMoreServerDetails(sid, error, parent_id)) {
+					Log(LOG_DEBUG, "Nope, so lets delete the parent...");
+					// If we are deleting the parent cluster, then whack all other clustered servers
+					// this is a bit crappy, but the only way to preserve the RI...
+					// Now go through and delete all server_touch records for the records we are
+					// about to whack in server_details
+
+					// Now delete the parent
+					sprintf(sql,"delete from servers where id = %s", parent_id);
+					if (mysql_real_query(&dbase,sql,strlen(sql))) {
+						sprintf(error, "servers: %s", mysql_error(&dbase));
+						sprintf(sql,"ROLLBACK");
+						mysql_real_query(&dbase,sql,strlen(sql));
+						return(YP_ERROR);
+					}
+				}
+				else {
+					Log(LOG_DEBUG, "Yep, so lets NOT delete the parent...");
+				}
+
+				sprintf(sql,"delete from servers_touch where id = '%s'", row[0]);
+				if (mysql_real_query(&dbase,sql,strlen(sql))) {
+					sprintf(error, "servers: %s", mysql_error(&dbase));
+					sprintf(sql,"ROLLBACK");
+					mysql_real_query(&dbase,sql,strlen(sql));
+					return(YP_ERROR);
+				}
+			}
+		}
+		mysql_free_result(result);
+		sprintf(sql,"COMMIT");
+		mysql_real_query(&dbase,sql,strlen(sql));
+	}
+	return(YP_SUCCESS);
+}
+
+int main(int argc, char * argv[])
+{
+	int res;
+	int	ret = 0;
+	int	ok = 0;
+	int	pid = 0;
+	char	error[2046];
+	int	loop = 1;
+
+	memset(error, '\000', sizeof(error));
+
+	setErrorType(LM_INFO);
+	setLogFile(YP_LOGDIR"yp-clean.log");
+
+	if (connectToDB()) {
+		ret = cleanServers(error);
+		if (ret == YP_ERROR) {
+			LogMessage(LOG_ERROR, "Error: %s", error);
+		}
+		LogMessage(LOG_INFO, "Ran clean servers OK");
+		ret = cleanServers2(error);
+		if (ret == YP_ERROR) {
+			LogMessage(LOG_ERROR, "Error: %s", error);
+		}
+		LogMessage(LOG_INFO, "Ran clean servers 2 OK");
+		ret = cleanServers3(error);
+		if (ret == YP_ERROR) {
+			LogMessage(LOG_ERROR, "Error: %s", error);
+		}
+		LogMessage(LOG_INFO, "Ran clean servers 3 OK");
+		ret = cleanServers4(error);
+		if (ret == YP_ERROR) {
+			LogMessage(LOG_ERROR, "Error: %s", error);
+		}
+		LogMessage(LOG_INFO, "Ran clean servers 4 OK");
+	}
+	return(0);
+}
+
+

Added: trunk/icecast2yp/src/yp_db.h
===================================================================
--- trunk/icecast2yp/src/yp_db.h	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/yp_db.h	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,4 @@
+#define YP_DB_HOST "localhost"
+#define YP_DB_USER "oddsock"
+#define YP_DB_PASSWORD ""
+#define YP_DB_DATABASE "oddsock"

Added: trunk/icecast2yp/src/yp_random.c
===================================================================
--- trunk/icecast2yp/src/yp_random.c	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/yp_random.c	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,93 @@
+/*********************************************
+YP-CLEAN by oddsock
+**********************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mysql.h>
+#include <unistd.h>
+#include "log.h"
+
+
+extern MYSQL		dbase;
+MYSQL_RES	*result;
+MYSQL_RES	*result2;
+
+#define YP_ERROR 0
+#define YP_SUCCESS 1
+
+
+int randomizeServers(char *error)
+{
+	char	sql[8096];
+	char	sid[2046];
+	int	i;
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+        char    detail_id[255] = "";
+        char    parent_id[255] = "";
+	char	*p1;
+	int	randomNumber = 0;
+
+	srand(time() + getpid());
+
+	memset(sql, '\000', sizeof(sql));
+
+	sprintf(sql,"select id from servers");
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		return(YP_ERROR);
+	}
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+	if(nrows == 0) {
+		return(YP_SUCCESS);
+	}
+	else {
+		for (i=0;i<nrows;i++) {
+			row = mysql_fetch_row(result);
+			if (row[0]) {
+				randomNumber = rand();
+				sprintf(sql,"update servers set rank = %d where id = %s", randomNumber, row[0]);
+				if (mysql_real_query(&dbase,sql,strlen(sql))) {
+					sprintf(error, "servers: %s", mysql_error(&dbase));
+					sprintf(sql,"ROLLBACK");
+					mysql_real_query(&dbase,sql,strlen(sql));
+					mysql_free_result(result);
+					return(YP_ERROR);
+				}
+			}
+		}
+		mysql_free_result(result);
+		sprintf(sql,"COMMIT");
+		mysql_real_query(&dbase,sql,strlen(sql));
+	}
+	return(YP_SUCCESS);
+}
+
+int main(int argc, char * argv[])
+{
+	int res;
+	int	ret = 0;
+	int	ok = 0;
+	int	pid = 0;
+	char	error[2046];
+	int	loop = 1;
+
+	memset(error, '\000', sizeof(error));
+
+	setErrorType(LM_INFO);
+	setLogFile(YP_LOGDIR"yp-random.log");
+
+	if (connectToDB()) {
+		ret = randomizeServers(error);
+		if (ret == YP_ERROR) {
+			LogMessage(LOG_ERROR, "Error: %s", error);
+		}
+	}
+	return(0);
+}
+
+

Added: trunk/icecast2yp/src/yp_routines.c
===================================================================
--- trunk/icecast2yp/src/yp_routines.c	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/yp_routines.c	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,924 @@
+/*********************************************
+YP-CGI by oddsock
+**********************************************/
+
+#include "yp_routines.h"
+#include "yp_db.h"
+
+static MYSQL_RES	*result;
+MYSQL	dbase;
+
+double  GetCurrentTime() {
+
+        double  thetime;
+
+        struct timeval  tv;
+        gettimeofday(&tv, NULL);
+        thetime = (double)tv.tv_sec + (double)((double)tv.tv_usec / (double)1000000);
+        return thetime;
+}
+static int hex(char c)
+{
+    if(c >= '0' && c <= '9')
+        return c - '0';
+    else if(c >= 'A' && c <= 'F')
+        return c - 'A' + 10;
+    else if(c >= 'a' && c <= 'f')
+        return c - 'a' + 10;
+    else
+        return -1;
+}
+
+char *url_decode(const char *src)
+{
+    int len = strlen(src);
+    unsigned char *decoded;
+    int i;
+    char *dst;
+    int done = 0;
+
+    decoded = calloc(1, len + 1);
+
+    dst = decoded;
+
+    for(i=0; i < len; i++) {
+        switch(src[i]) {
+            case '%':
+                if(i+2 >= len) {
+                    free(decoded);
+                    return NULL;
+                }
+                if(hex(src[i+1]) == -1 || hex(src[i+2]) == -1 ) {
+                    free(decoded);
+                    return NULL;
+                }
+
+                *dst++ = hex(src[i+1]) * 16  + hex(src[i+2]);
+                i+= 2;
+                break;
+            case '#':
+                done = 1;
+                break;
+            case 0:
+		Log(LOG_ERROR, "Major problem with url_decode()");
+                free(decoded);
+                return NULL;
+                break;
+            default:
+                *dst++ = src[i];
+                break;
+        }
+        if(done)
+            break;
+    }
+
+    *dst = 0; /* null terminator */
+
+    return decoded;
+}
+
+int genSID(char *sid, char *error)
+{
+	char	key[1024];
+	int i = 0;
+	char	sql[8096];
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+
+
+	Log(LOG_DEBUG, "Generating SID");
+	for (i=0;i<10;i++) {
+		memset(key, '\000', sizeof(key));
+		sprintf(key, "%f", GetCurrentTime());
+		Log(LOG_DEBUG, "Key %d = %s", i, key);
+
+		memset(sql, '\000', sizeof(sql));
+
+		sprintf(sql,"select count(*) from servers where sid = \'%s\'",key);
+		if(mysql_real_query(&dbase,sql,strlen(sql))) {
+			strcpy(error, mysql_error(&dbase));
+			return(YP_ERROR);
+		}
+		result = mysql_store_result(&dbase);
+		nrows = mysql_num_rows(result);
+		if(nrows == 0) {
+			return(YP_ERROR);
+		}
+		else {
+			row = mysql_fetch_row(result);
+			mysql_free_result(result);
+			existing = 0;
+			if (row[0]) {
+				existing = atoi(row[0]);
+			}
+			if (!existing) {
+				strcpy(sid, key);
+				break;
+			}
+		}
+	}
+	return(YP_SUCCESS);
+
+}
+void disconnectFromDB() {
+	mysql_close(&dbase);
+}
+int connectToDB() {
+	char	*pDBHost = NULL;
+	char	*pDBUser = NULL;
+	char	*pDBPassword = NULL;
+	char	*pDBDatabase = NULL;
+	FILE	*filep = NULL;
+	char	envstring[255] = "";
+
+	filep = fopen("/home/oddsock/yp.db", "r");
+	if (filep) {
+		while (!feof(filep)) {
+			memset(envstring, '\000', sizeof(envstring));
+			fgets(envstring, sizeof(envstring)-1, filep);
+			if (strlen(envstring) > 0) {
+				putenv(envstring);
+			}
+		}
+		fclose(filep);
+	}
+
+
+	if(mysql_init(&dbase) != NULL)	{
+		if (mysql_real_connect(&dbase,YP_DB_HOST,YP_DB_USER,YP_DB_PASSWORD,YP_DB_DATABASE,3306,NULL,0) == NULL) {
+			return 0;
+		}
+	}
+	else {
+		return 0;
+	}
+	return 1;
+}
+int checkForCluster(char *server_name, char *listing_ip, char *error, char *existing_id)
+{
+	char	sql[8096];
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+	char	*server_name_esc = NULL;
+
+	memset(sql, '\000', sizeof(sql));
+
+	server_name_esc = malloc(strlen(server_name)*2 + 1);
+	memset(server_name_esc, '\000', strlen(server_name)*2 + 1);
+	mysql_real_escape_string(&dbase, server_name_esc, server_name, strlen(server_name));
+
+	snprintf(sql, sizeof(sql)-1, "select id from servers where server_name = \'%s\' and listing_ip = '%s'",server_name_esc, listing_ip);
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		free(server_name_esc);
+		return(YP_ERROR);
+	}
+
+	free(server_name_esc);
+	server_name_esc = NULL;
+
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+
+	if(nrows == 0) {
+		existing = 0;
+	}
+	else {
+		row = mysql_fetch_row(result);
+		mysql_free_result(result);
+		if (row[0]) {
+			existing = 1;
+			strcpy(existing_id, row[0]);
+		}
+	}
+	return existing;
+}
+int anyMoreServerDetails(char *sid, char *error, char *parent_id)
+{
+	char	sql[8096];
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+
+	memset(sql, '\000', sizeof(sql));
+
+	snprintf(sql, sizeof(sql)-1, "select count(*) from server_details where parent_id = %s",parent_id);
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		return(YP_ERROR);
+	}
+
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+
+	if(nrows == 0) {
+		return(0);
+	}
+	else {
+		row = mysql_fetch_row(result);
+		mysql_free_result(result);
+		if (row[0]) {
+			if (atoi(row[0]) > 0) {
+				return(1);
+			}
+		}
+		else {
+			return(0);
+		}
+	}
+	return(0);
+}
+int getClusterIDBySID(char *sid, char *error, char *cluster_id)
+{
+	char	sql[8096];
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+
+	memset(sql, '\000', sizeof(sql));
+
+	snprintf(sql, sizeof(sql)-1, "select cluster_id from servers where id = %s",sid);
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		return(YP_ERROR);
+	}
+
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+
+	if(nrows == 0) {
+		return(0);
+	}
+	else {
+		row = mysql_fetch_row(result);
+		mysql_free_result(result);
+		if (row[0]) {
+			strcpy(cluster_id, row[0]);
+		}
+		else {
+			return(0);
+		}
+	}
+	return(1);
+}
+int getClusterID(char *server_name, char *listing_ip, char *error, char *cluster_id)
+{
+	char	sql[8096];
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+	char	*server_name_esc = NULL;
+
+	memset(sql, '\000', sizeof(sql));
+
+	server_name_esc = malloc(strlen(server_name)*2 + 1);
+	memset(server_name_esc, '\000', strlen(server_name)*2 + 1);
+	mysql_real_escape_string(&dbase, server_name_esc, server_name, strlen(server_name));
+
+	snprintf(sql, sizeof(sql)-1, "select cluster_id from servers where server_name = \'%s\' and listing_ip = '%s'",server_name_esc, listing_ip);
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		free(server_name_esc);
+		return(YP_ERROR);
+	}
+
+	free(server_name_esc);
+	server_name_esc = NULL;
+
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+
+	if(nrows == 0) {
+		return(0);
+	}
+	else {
+		row = mysql_fetch_row(result);
+		mysql_free_result(result);
+		if (row[0]) {
+			strcpy(cluster_id, row[0]);
+		}
+		else {
+			return(0);
+		}
+	}
+	return(1);
+}
+int updateClusterID(char *server_name, char *listing_ip, char *error, char *cluster_id)
+{
+	char	sql[8096];
+	char	sql2[8096];
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+	char	*server_name_esc = NULL;
+
+	memset(sql, '\000', sizeof(sql));
+	memset(sql2, '\000', sizeof(sql2));
+
+	server_name_esc = malloc(strlen(server_name)*2 + 1);
+	memset(server_name_esc, '\000', strlen(server_name)*2 + 1);
+	mysql_real_escape_string(&dbase, server_name_esc, server_name, strlen(server_name));
+
+	snprintf(sql, sizeof(sql)-1, "update clustered_servers set cluster_id = %s where server_name = \'%s\' and listing_ip = '%s'",cluster_id, server_name_esc, listing_ip);
+	snprintf(sql2, sizeof(sql2)-1, "update servers set cluster_id = %s where server_name = \'%s\' and listing_ip = '%s'",cluster_id, server_name_esc, listing_ip);
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		free(server_name_esc);
+		return(YP_ERROR);
+	}
+
+	free(server_name_esc);
+	server_name_esc = NULL;
+
+	nrows = mysql_affected_rows(&dbase);
+
+	if(nrows == 0) {
+		strcpy(error, "update of cluster_id for clustered servers failed");
+		return(YP_ERROR);
+	}
+
+	if(mysql_real_query(&dbase,sql2,strlen(sql2))) {
+		strcpy(error, mysql_error(&dbase));
+		free(server_name_esc);
+		return(YP_ERROR);
+	}
+	nrows = mysql_affected_rows(&dbase);
+
+	if(nrows == 0) {
+		strcpy(error, "update of cluster_id for servers failed");
+		return(YP_ERROR);
+	}
+	return(1);
+}
+
+int addServer(char *server_name, char *genre, char *cluster_password, char *desc, char *url, char *listenurl, char *server_type, char *bitrate, char *listing_ip, char *sid, char *samplerate, char *channels, char *error)
+{
+	char	sql[8096];
+	int	i;
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+	char	*server_name_esc = NULL;
+	char	*genre_esc = NULL;
+	char	*desc_esc = NULL;
+	char	*url_esc = NULL;
+	char	*server_type_esc = NULL;
+	char	*bitrate_esc = NULL;
+	char	*listenurl_esc = NULL;
+	char	*listeners_esc = NULL;
+	char	*samplerate_esc = NULL;
+	char	*channels_esc = NULL;
+	int	cluster_flag = 0;
+	int	have_cluster_id = 0;
+	char	table_name[255] = "";
+	char	parent_id[255] = "";
+	char	detail_id[255] = "";
+	int	ret = 0;
+
+	/* Check for Dupes */
+	memset(sql, '\000', sizeof(sql));
+
+	server_name_esc = malloc(strlen(server_name)*2 + 1);
+	memset(server_name_esc, '\000', strlen(server_name)*2 + 1);
+	mysql_real_escape_string(&dbase, server_name_esc, server_name, strlen(server_name));
+
+	listenurl_esc = malloc(strlen(listenurl)*2 + 1);
+	memset(listenurl_esc, '\000', strlen(listenurl)*2 + 1);
+	mysql_real_escape_string(&dbase, listenurl_esc, listenurl, strlen(listenurl));
+
+	Log(LOG_DEBUG, "Going to execute %s", sql);
+	snprintf(sql, sizeof(sql)-1, "select count(*) from servers a, server_details b where a.server_name = \'%s\' and b.listen_url = '%s' and a.id = b.parent_id", server_name_esc, listenurl_esc);
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		goto Error;
+	}
+
+	free(server_name_esc);
+	free(listenurl_esc);
+	server_name_esc = NULL;
+	listenurl_esc = NULL;
+
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+	if(nrows == 0) {
+		Log(LOG_DEBUG, "Num rows for the count(*) is 0..hmmm");
+		goto Error;
+	}
+	else {
+		row = mysql_fetch_row(result);
+		mysql_free_result(result);
+		if (row[0]) {
+			existing = atoi(row[0]);
+		}
+		if (existing) {
+			return(YP_EXISTS);
+		}
+	}
+
+	memset(sql, '\000', sizeof(sql));
+
+	Log(LOG_DEBUG, "Checking for a cluster");
+	existing = checkForCluster(server_name, listing_ip, error, parent_id);
+	if (existing == YP_ERROR) {
+		Log(LOG_DEBUG, "check for cluster returned error");
+		goto Error;
+	}
+	if (existing) {
+		cluster_flag = 1;
+	}
+	Log(LOG_DEBUG, "Done Checking for a cluster");
+
+	if (cluster_flag) {
+		strcpy(table_name, "clustered_servers");
+		Log(LOG_DEBUG, "Cluster flag is set!");
+	}
+	else {
+		strcpy(table_name, "servers");
+		Log(LOG_DEBUG, "Cluster flag is NOT set!");
+	}
+
+	if (!strcmp(server_name, "Example stream name")) {
+		sprintf(error, "Bad stream name, be more original");
+		goto Error;
+	}
+
+	server_name_esc = malloc(strlen(server_name)*2 + 1);
+	memset(server_name_esc, '\000', strlen(server_name)*2 + 1);
+	genre_esc = malloc(strlen(genre)*2 + 1);
+	memset(genre_esc, '\000', strlen(genre)*2 + 1);
+	url_esc = malloc(strlen(url)*2 + 1);
+	memset(url_esc, '\000', strlen(url)*2 + 1);
+	desc_esc = malloc(strlen(desc)*2 + 1);
+	memset(desc_esc, '\000', strlen(desc)*2 + 1);
+	server_type_esc = malloc(strlen(server_type)*2 + 1);
+	memset(server_type_esc, '\000', strlen(server_type)*2 + 1);
+	bitrate_esc = malloc(strlen(bitrate)*2 + 1);
+	memset(bitrate_esc, '\000', strlen(bitrate)*2 + 1);
+	listenurl_esc = malloc(strlen(listenurl)*2 + 1);
+	memset(listenurl_esc, '\000', strlen(listenurl)*2 + 1);
+	samplerate_esc = malloc(strlen(samplerate)*2 + 1);
+	memset(samplerate_esc, '\000', strlen(samplerate)*2 + 1);
+	channels_esc = malloc(strlen(channels)*2 + 1);
+	memset(channels_esc, '\000', strlen(channels)*2 + 1);
+
+	mysql_real_escape_string(&dbase, server_name_esc, server_name, strlen(server_name));
+	mysql_real_escape_string(&dbase, genre_esc, genre, strlen(genre));
+	mysql_real_escape_string(&dbase, url_esc, url, strlen(url));
+	mysql_real_escape_string(&dbase, desc_esc, desc, strlen(desc));
+	mysql_real_escape_string(&dbase, server_type_esc, server_type, strlen(server_type));
+	mysql_real_escape_string(&dbase, bitrate_esc, bitrate, strlen(bitrate));
+	mysql_real_escape_string(&dbase, listenurl_esc, listenurl, strlen(listenurl));
+	mysql_real_escape_string(&dbase, samplerate_esc, samplerate, strlen(samplerate));
+	mysql_real_escape_string(&dbase, channels_esc, channels, strlen(channels));
+
+
+	if (!cluster_flag) {
+		snprintf(sql, sizeof(sql)-1, "insert into servers (server_name, listing_ip) values  ('%s', '%s')", server_name_esc, listing_ip);
+		Log(LOG_DEBUG, "This isn't a cluster, it's just a new stream");
+		if (mysql_real_query(&dbase,sql,strlen(sql))) {
+			sprintf(error, "servers: %s", mysql_error(&dbase));
+			sprintf(sql,"ROLLBACK");
+			mysql_real_query(&dbase,sql,strlen(sql));
+			goto Error;
+		}
+		sprintf(parent_id, "%d", mysql_insert_id(&dbase));
+	}
+
+	Log(LOG_DEBUG, sql);
+
+	snprintf(sql, sizeof(sql)-1, "insert into \
+		server_details (parent_id,		\
+			  server_name,		\
+			  listing_ip,		\
+			  description,		\
+			  genre,		\
+			  sid,			\
+			  cluster_password,	\
+			  url,			\
+			  current_song,		\
+			  listen_url,		\
+			  server_type,		\
+			  bitrate,		\
+			  listeners,		\
+			  samplerate,		\
+			  channels)		\
+		 values  (%s,			\
+			  '%s',			\
+			  '%s',			\
+			  '%s',			\
+			  '%s',			\
+			  '%s',			\
+			  '%s',			\
+			  '%s',			\
+			  '%s',			\
+			  '%s',			\
+			  '%s',			\
+			  '%s',			\
+			  0,			\
+			  '%s',			\
+			  '%s')", parent_id, server_name_esc, listing_ip, desc_esc, genre_esc, sid, cluster_password, url_esc, "", listenurl_esc, server_type_esc, bitrate_esc, samplerate_esc, channels_esc);
+	if (mysql_real_query(&dbase,sql,strlen(sql))) {
+		sprintf(error, "servers: %s", mysql_error(&dbase));
+		sprintf(sql,"ROLLBACK");
+		mysql_real_query(&dbase,sql,strlen(sql));
+		goto Error;
+	}
+	Log(LOG_DEBUG, "We have a parent id, which means this is part of a cluster that is currently in operation");
+
+	// If we didn't have a cluster id before, this means that
+	// we need up update the record in clustered_servers to reflect the newly generated cluster id
+	sprintf(detail_id, "%d", mysql_insert_id(&dbase));
+
+	sprintf(sid, "%s-%s", parent_id, detail_id);
+
+	setLogSid(sid);
+
+	Log(LOG_DEBUG, "Going to insert into servers_touch now...");
+	sprintf(sql,"insert into servers_touch (id, server_name, listing_ip, last_touch) values  ('%s', '%s', '%s', NOW())", sid, server_name_esc, listing_ip);
+
+	Log(LOG_DEBUG, sql);
+
+	if (mysql_real_query(&dbase,sql,strlen(sql))) {
+		sprintf(error, "servers_info: %s", mysql_error(&dbase));
+		sprintf(sql,"ROLLBACK");
+		mysql_real_query(&dbase,sql,strlen(sql));
+		return(YP_ERROR);
+	}
+	sprintf(sql,"COMMIT");
+	mysql_real_query(&dbase,sql,strlen(sql));
+	Log(LOG_DEBUG, "Everything is good");
+	if (server_name_esc) {
+		free(server_name_esc);
+	}
+	if (desc_esc) {
+		free(desc_esc);
+	}
+	if (genre_esc) {
+		free(genre_esc);
+	}
+	if (url_esc) {
+		free(url_esc);
+	}
+	if (server_type_esc) {
+		free(server_type_esc);
+	}
+	if (bitrate_esc) {
+		free(bitrate_esc);
+	}
+	if (listenurl_esc) {
+		free(listenurl_esc);
+	}
+	if (samplerate_esc) {
+		free(samplerate_esc);
+	}
+	if (channels_esc) {
+		free(channels_esc);
+	}
+	return(YP_ADDED);
+Error:
+	if (server_name_esc) {
+		free(server_name_esc);
+	}
+	if (desc_esc) {
+		free(desc_esc);
+	}
+	if (genre_esc) {
+		free(genre_esc);
+	}
+	if (url_esc) {
+		free(url_esc);
+	}
+	if (server_type_esc) {
+		free(server_type_esc);
+	}
+	if (bitrate_esc) {
+		free(bitrate_esc);
+	}
+	if (listenurl_esc) {
+		free(listenurl_esc);
+	}
+	if (samplerate_esc) {
+		free(samplerate_esc);
+	}
+	if (channels_esc) {
+		free(channels_esc);
+	}
+	return(YP_ERROR);
+
+}
+
+
+int touchServer(char *sid, char *touchip, char *cluster_password, char *song, char *listeners, char *genre, char *desc, char *listenurl, char *server_type, char *bitrate, char *server_name, char *error, int touchType)
+{
+	char	sql[8096];
+	int	i;
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+	char	*song_esc = NULL;
+	char	*genre_esc = NULL;
+	char	*listenurl_esc = NULL;
+	char	*server_type_esc = NULL;
+	char	*bitrate_esc = NULL;
+	char	*desc_esc = NULL;
+	char	*server_name_esc = NULL;
+	int	cluster_flag = 0;
+	char	detail_id[255] = "";
+	char	parent_id[255] = "";
+	char	*p1;
+
+	memset(sql, '\000', sizeof(sql));
+
+	memset(detail_id, '\000', sizeof(detail_id));
+	memset(parent_id, '\000', sizeof(parent_id));
+	p1 = strchr(sid, '-');
+	if (p1) {
+		cluster_flag = 1;
+		strncpy(parent_id, sid, p1-sid);
+		strcpy(detail_id, p1+1);
+	}
+
+	sprintf(sql,"select listing_ip from servers_touch where id = \'%s\'",sid);
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		goto TouchError;
+	}
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+	if(nrows == 0) {
+		goto TouchError;
+	}
+	else {
+		row = mysql_fetch_row(result);
+		if (row[0]) {
+			if (strcmp(touchip, row[0])) {
+				strcpy(error, "trying to touch from a different IP than was added");
+				return(YP_ERROR);
+			}
+		}
+		mysql_free_result(result);
+
+		song_esc = malloc(strlen(song)*2 + 1);
+		memset(song_esc, '\000', strlen(song)*2 + 1);
+		mysql_real_escape_string(&dbase, song_esc, song, strlen(song));
+
+		sprintf(sql,"update server_details set current_song = \'%s\', listeners = %d where id = %s", song_esc, atol(listeners), detail_id);
+
+		Log(LOG_DEBUG, sql);
+		if (mysql_real_query(&dbase,sql,strlen(sql))) {
+			sprintf(error, "servers: %s", mysql_error(&dbase));
+			Log(LOG_ERROR, error);
+			sprintf(sql,"ROLLBACK");
+			mysql_real_query(&dbase,sql,strlen(sql));
+			goto TouchError;
+		}
+		if (mysql_affected_rows(&dbase) < 0) {
+			// something squirly...
+			sprintf(error, "Error updating server info, %d records updated", mysql_affected_rows(&dbase));
+			Log(LOG_ERROR, error);
+			sprintf(sql,"ROLLBACK");
+			mysql_real_query(&dbase,sql,strlen(sql));
+			goto TouchError;
+		}
+
+		sprintf(sql,"update servers_touch set last_touch = NOW() where id = '%s'", sid);
+
+		Log(LOG_DEBUG, sql);
+
+		if (mysql_real_query(&dbase,sql,strlen(sql))) {
+			sprintf(error, "servers_touch: %s", mysql_error(&dbase));
+			Log(LOG_ERROR, error);
+			sprintf(sql,"ROLLBACK");
+			mysql_real_query(&dbase,sql,strlen(sql));
+			goto TouchError;
+		}
+		if (mysql_affected_rows(&dbase) < 0) {
+			// something squirly...
+			sprintf(error, "Error updating server touch info, %d records updated", mysql_affected_rows(&dbase));
+			Log(LOG_ERROR, error);
+			sprintf(sql,"ROLLBACK");
+			mysql_real_query(&dbase,sql,strlen(sql));
+			goto TouchError;
+		}
+		sprintf(sql,"COMMIT");
+		mysql_real_query(&dbase,sql,strlen(sql));
+
+
+		sprintf(sql,"select sum(listeners) from server_details where parent_id = %s",parent_id);
+		if(mysql_real_query(&dbase,sql,strlen(sql))) {
+			strcpy(error, mysql_error(&dbase));
+			goto TouchError;
+		}
+		result = mysql_store_result(&dbase);
+		nrows = mysql_num_rows(result);
+		if(nrows == 0) {
+			goto TouchError;
+		}
+		else {
+			row = mysql_fetch_row(result);
+			if (row[0]) {
+				sprintf(sql,"update servers set listeners = %s where id = %s", row[0], parent_id);
+
+				Log(LOG_DEBUG, sql);
+
+				if (mysql_real_query(&dbase,sql,strlen(sql))) {
+					sprintf(error, "servers_touch: %s", mysql_error(&dbase));
+					Log(LOG_ERROR, error);
+					sprintf(sql,"ROLLBACK");
+					mysql_real_query(&dbase,sql,strlen(sql));
+					goto TouchError;
+				}
+			}
+		}
+
+		mysql_free_result(result);
+
+		Log(LOG_DEBUG, "YP Touched");
+		if (song_esc) {
+			free(song_esc);
+		}
+		if (genre_esc) {
+			free(genre_esc);
+		}
+		if (listenurl_esc) {
+			free(listenurl_esc);
+		}
+		if (server_type_esc) {
+			free(server_type_esc);
+		}
+		if (bitrate_esc) {
+			free(bitrate_esc);
+		}
+		if (desc_esc) {
+			free(desc_esc);
+		}
+		if (server_name_esc) {
+			free(server_name_esc);
+		}
+		return(YP_TOUCHED);
+	}
+TouchError:
+	if (song_esc) {
+		free(song_esc);
+	}
+	if (genre_esc) {
+		free(genre_esc);
+	}
+	if (listenurl_esc) {
+		free(listenurl_esc);
+	}
+	if (server_type_esc) {
+		free(server_type_esc);
+	}
+	if (bitrate_esc) {
+		free(bitrate_esc);
+	}
+	if (desc_esc) {
+		free(desc_esc);
+	}
+	if (server_name_esc) {
+		free(server_name_esc);
+	}
+	return(YP_ERROR);
+
+}
+int removeServer(char *sid, char *removeip, char *cluster_password, char *error)
+{
+	char	sql[8096];
+	int	i;
+	MYSQL_ROW	row;
+	int	existing = 0;
+	int	nrows = 0;
+	int	cluster_flag = 0;
+	char	detail_id[255] = "";
+	char	parent_id[255] = "";
+	char	*p1;
+
+	memset(sql, '\000', sizeof(sql));
+
+	memset(detail_id, '\000', sizeof(detail_id));
+	memset(parent_id, '\000', sizeof(parent_id));
+	p1 = strchr(sid, '-');
+	if (p1) {
+		cluster_flag = 1;
+		strncpy(parent_id, sid, p1-sid);
+		strcpy(detail_id, p1+1);
+	}
+
+	memset(sql, '\000', sizeof(sql));
+
+	sprintf(sql,"select listing_ip from servers_touch where id = '%s'",sid);
+	if(mysql_real_query(&dbase,sql,strlen(sql))) {
+		strcpy(error, mysql_error(&dbase));
+		return(YP_ERROR);
+	}
+	result = mysql_store_result(&dbase);
+	nrows = mysql_num_rows(result);
+	if(nrows == 0) {
+		return(YP_ERROR);
+	}
+	else {
+		row = mysql_fetch_row(result);
+		if (row[0]) {
+			if (strcmp(removeip, row[0])) {
+				strcpy(error, "trying to remove from a different IP than was added");
+				return(YP_ERROR);
+			}
+		}
+		mysql_free_result(result);
+
+		sprintf(sql,"delete from server_details where id = %s", detail_id);
+		if (mysql_real_query(&dbase,sql,strlen(sql))) {
+			sprintf(error, "clustered_servers: %s", mysql_error(&dbase));
+			sprintf(sql,"ROLLBACK");
+			mysql_real_query(&dbase,sql,strlen(sql));
+			return(YP_ERROR);
+		}
+
+		// At this point, we need to check to see if there are any server_details left for this
+		// parent, if not, then delete the parent, if so, then leave the parent, because
+		// this is a cluster.
+
+		Log(LOG_DEBUG, "Checking to see if there are any more server details");
+		if (!anyMoreServerDetails(sid, error, parent_id)) {
+			Log(LOG_DEBUG, "Nope, so lets delete the parent...");
+			// If we are deleting the parent cluster, then whack all other clustered servers
+			// this is a bit crappy, but the only way to preserve the RI...
+			// Now go through and delete all server_touch records for the records we are
+			// about to whack in clustered_servers
+
+			// Now delete the parent
+			sprintf(sql,"delete from servers where id = %s", parent_id);
+			if (mysql_real_query(&dbase,sql,strlen(sql))) {
+				sprintf(error, "servers: %s", mysql_error(&dbase));
+				sprintf(sql,"ROLLBACK");
+				mysql_real_query(&dbase,sql,strlen(sql));
+				return(YP_ERROR);
+			}
+		}
+		else {
+			Log(LOG_DEBUG, "Yep, so lets NOT delete the parent...");
+		}
+
+		sprintf(sql,"delete from servers_touch where id = '%s'", sid);
+
+		if (mysql_real_query(&dbase,sql,strlen(sql))) {
+			sprintf(error, "servers_info: %s", mysql_error(&dbase));
+			sprintf(sql,"ROLLBACK");
+			mysql_real_query(&dbase,sql,strlen(sql));
+			return(YP_ERROR);
+		}
+		if (mysql_affected_rows(&dbase) < 0) {
+			// something squirly...
+			sprintf(error, "Error removing server info, %d records deleted", mysql_affected_rows(&dbase));
+			sprintf(sql,"ROLLBACK");
+			mysql_real_query(&dbase,sql,strlen(sql));
+			return(YP_ERROR);
+		}
+		sprintf(sql,"COMMIT");
+		mysql_real_query(&dbase,sql,strlen(sql));
+		return(YP_TOUCHED);
+	}
+	return(YP_ERROR);
+
+}
+
+void sendOK()
+{
+	printf("HTTP/1.0 200 OK\r\n");
+
+}
+void sendHTML(char *html)
+{
+	static int	headersent = 0;
+
+	if (!headersent) {
+		printf("Content-type: text/html\n\n");
+		headersent = 1;
+	}
+	printf("%s", html);
+}
+void sendYPResponse(int errorcode, char *msg, int type)
+{
+	if (errorcode == 0) {
+		Log(LOG_INFO, msg);
+	}
+	if (type == AUDIOCAST_RESPONSE) {
+		if (errorcode != 1) {
+			printf("x-audiocast-yp-error: %d %s\r\n\r\n", errorcode, msg);
+		}
+	}
+	if (type == ICECAST2_RESPONSE) {
+		if (strlen(msg) == 0) {
+			printf("YPResponse: 0\r\nYPMessage: NAK\r\n\r\n", errorcode);
+			Log(LOG_DEBUG, "Sending NAK");
+		}
+		else {
+			printf("YPResponse: %d\r\nYPMessage: %s\r\n\r\n", errorcode, msg);
+		}
+	}
+}
+
+

Added: trunk/icecast2yp/src/yp_routines.h
===================================================================
--- trunk/icecast2yp/src/yp_routines.h	2004-07-31 18:36:40 UTC (rev 7435)
+++ trunk/icecast2yp/src/yp_routines.h	2004-07-31 21:50:32 UTC (rev 7436)
@@ -0,0 +1,42 @@
+#ifndef __YP_ROUTINES_H__
+#define __YP_ROUTINES_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <mysql.h>
+#include "cgi.h"
+#include <unistd.h>
+#include "log.h"
+
+#define NO_ACTION	0
+#define ADD	1
+#define TOUCH	2
+#define REMOVE	3
+
+#define YP_ERROR -1
+#define YP_EXISTS 1
+#define YP_ADDED 2
+#define YP_TOUCHED 3
+#define YP_REMOVED 4
+#define YP_SUCCESS 5
+
+#define AUDIOCAST_RESPONSE 1
+#define ICECAST2_RESPONSE 2
+
+#define AUDIOCAST_TOUCH 1
+#define NORMAL_TOUCH 2
+
+
+double  GetCurrentTime();
+int genSID(char *sid, char *error);
+int connectToDB() ;
+int addServer(char *server_name, char *genre, char *cluster_password, char *desc, char *url, char *listenurl, char *server_type, char *bitrate, char *listing_ip, char *sid, char *samplerate, char *channels, char *error);
+int touchServer(char *sid, char *touchip, char *cluster_password, char *song, char *listeners, char *genre, char *desc, char *listenurl, char *server_type, char *bitrate, char *server_name, char *error, int touchType);
+int removeServer(char *sid, char *removeip, char *cluster_password, char *error);
+void sendOK();
+void sendHTML(char *html);
+void sendYPResponse(int errorcode, char *msg, int type);
+void disconnectFromDB();
+char *url_decode(const char *src);
+#endif



More information about the commits mailing list