begin work on more cmd=info stuff
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 23 Feb 2011 16:01:34 +0000 (17:01 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 23 Feb 2011 16:01:34 +0000 (17:01 +0100)
src/http_command.c
src/pazpar2_config.c
src/pazpar2_config.h

index bdd68a8..5509b34 100644 (file)
@@ -1103,6 +1103,8 @@ static void cmd_info(struct http_channel *c)
 
     wrbuf_puts(c->wrbuf, " </version>\n");
     
+    info_services(c->server, c->wrbuf);
+
     wrbuf_puts(c->wrbuf, "</info>");
     rs->payload = nmem_strdup(c->nmem, wrbuf_cstr(c->wrbuf));
     http_send_response(c);
index 787f680..740ac9c 100644 (file)
@@ -933,6 +933,25 @@ struct conf_service *locate_service(struct conf_server *server,
     return s;
 }
 
+void info_services(struct conf_server *server, WRBUF w)
+{
+    struct conf_service *s = server->service;
+    wrbuf_puts(w, " <services>\n");
+    for (; s; s = s->next)
+    {
+        wrbuf_puts(w, "  <service");
+        if (s->id)
+        {
+            wrbuf_puts(w, " id=\"");
+            wrbuf_xmlputs(w, s->id);
+            wrbuf_puts(w, "\"");
+        }
+        wrbuf_puts(w, "/>");
+
+        wrbuf_puts(w, "\n");
+    }
+    wrbuf_puts(w, " </services>\n");
+}
 
 static int parse_config(struct conf_config *config, xmlNode *root)
 {
index 3f33b5f..0bb9cbe 100644 (file)
@@ -164,6 +164,7 @@ struct conf_targetprofiles
 struct conf_config *config_create(const char *fname, int verbose);
 void config_destroy(struct conf_config *config);
 void config_process_events(struct conf_config *config);
+void info_services(struct conf_server *server, WRBUF w);
 
 struct conf_service *locate_service(struct conf_server *server,
                                     const char *service_id);