[xiph-cvs] cvs commit: icecast/src config.c config.h

Ed oddsock at xiph.org
Sun Feb 2 06:24:59 PST 2003



oddsock     03/02/02 09:24:59

  Modified:    src      config.c config.h
  Log:
  new configuration entries for yp listing

Revision  Changes    Path
1.21      +18 -1     icecast/src/config.c

Index: config.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- config.c	29 Dec 2002 14:06:20 -0000	1.20
+++ config.c	2 Feb 2003 14:24:58 -0000	1.21
@@ -4,7 +4,11 @@
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 #include "config.h"
+#include "refbuf.h"
+#include "client.h"
+#include "logging.h" 
 
+#define CATMODULE "CONFIG"
 #define CONFIG_DEFAULT_LOCATION "Earth"
 #define CONFIG_DEFAULT_ADMIN "icemaster at localhost"
 #define CONFIG_DEFAULT_CLIENT_LIMIT 256
@@ -28,6 +32,7 @@
 #define CONFIG_DEFAULT_USER NULL
 #define CONFIG_DEFAULT_GROUP NULL
 #define CONFIG_MASTER_UPDATE_INTERVAL 120
+#define CONFIG_YP_URL_TIMEOUT 10
 
 #ifndef _WIN32
 #define CONFIG_DEFAULT_BASE_DIR "/usr/local/icecast"
@@ -185,6 +190,7 @@
     _configuration.chuid = CONFIG_DEFAULT_CHUID;
     _configuration.user = CONFIG_DEFAULT_USER;
     _configuration.group = CONFIG_DEFAULT_GROUP;
+    _configuration.num_yp_directories = 0;
 }
 
 static void _parse_root(xmlDocPtr doc, xmlNodePtr node)
@@ -298,11 +304,21 @@
 {
         char *tmp;
 
+	if (_configuration.num_yp_directories >= MAX_YP_DIRECTORIES) {
+		ERROR0("Maximum number of yp directories exceeded!");
+		return;
+	}
         do {
                 if (node == NULL) break;
                 if (xmlIsBlankNode(node)) continue;
 
-		if (strcmp(node->name, "server") == 0) {
+		if (strcmp(node->name, "yp-url") == 0) {
+			if (_configuration.yp_url[_configuration.num_yp_directories]) xmlFree(_configuration.yp_url[_configuration.num_yp_directories]);
+			_configuration.yp_url[_configuration.num_yp_directories] = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+        } else if (strcmp(node->name, "yp-url-timeout") == 0) {
+            tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
+            _configuration.yp_url_timeout[_configuration.num_yp_directories] = atoi(tmp);
+		} else if (strcmp(node->name, "server") == 0) {
                         _add_server(doc, node->xmlChildrenNode);
                 } else if (strcmp(node->name, "touch-freq") == 0) {
                         tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
@@ -310,6 +326,7 @@
                         if (tmp) xmlFree(tmp);
                 }
         } while ((node = node->next));
+	_configuration.num_yp_directories++;
 }
 
 static void _parse_paths(xmlDocPtr doc, xmlNodePtr node)

<p><p>1.11      +5 -0      icecast/src/config.h

Index: config.h
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- config.h	18 Aug 2002 05:06:58 -0000	1.10
+++ config.h	2 Feb 2003 14:24:58 -0000	1.11
@@ -6,6 +6,8 @@
 #define CONFIG_EBADROOT -3
 #define CONFIG_EPARSE -4
 
+#define MAX_YP_DIRECTORIES 25
+
 typedef struct ice_config_dir_tag
 {
         char *host;
@@ -53,6 +55,9 @@
     int chuid;
     char *user;
     char *group;
+    char *yp_url[MAX_YP_DIRECTORIES];
+    int	yp_url_timeout[MAX_YP_DIRECTORIES];
+    int num_yp_directories;
 } ice_config_t;
 
 void config_initialize(void);

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list