Read XML input,
[gnucomo.git] / src / gcm_input / message.h
index 03a8209..34c8eb8 100644 (file)
@@ -1,12 +1,14 @@
 
 /**************************************************************************
 **  (c) Copyright 2002, Andromeda Technology & Automation
+** This is free software; you can redistribute it and/or modify it under the
+** terms of the GNU General Public License, see the file COPYING.
 ***************************************************************************
 ** MODULE INFORMATION *
 ***********************
 **      FILE NAME      : message.h
 **      SYSTEM NAME    : 
-**      VERSION NUMBER : $Revision: 1.1 $
+**      VERSION NUMBER : $Revision: 1.6 $
 **
 **  DESCRIPTION      :  Classes to for handling client messages
 **
 ********************************
 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
 **      CREATION DATE   : Sep 16, 2002
-**      LAST UPDATE     : Oct 05, 2002
+**      LAST UPDATE     : Apr 28, 2003
 **      MODIFICATIONS   : 
 **************************************************************************/
 
 /*****************************
    $Log: message.h,v $
-   Revision 1.1  2002-10-05 10:25:49  arjen
+   Revision 1.6  2003-04-29 09:16:44  arjen
+   Read XML input,
+   Only cooked log entries for now.
+
+   Revision 1.5  2003/03/16 09:42:40  arjen
+   Read IRIX system logs.
+
+   Revision 1.4  2002/12/06 22:26:28  arjen
+   Set the value of log.processed to FALSE when inserting a
+   new log entry into the database
+   When a syslog entry arrives from last year, gcm_input subtracts one from the
+   year of arrival to create the year of the log entry.
+   Read output from "rpm -qa" and enter packages in the parameter table.
+
+   Revision 1.3  2002/11/09 08:04:27  arjen
+   Added a reference to the GPL
+
+   Revision 1.2  2002/11/04 10:13:36  arjen
+   Use proper namespace for iostream classes
+
+   Revision 1.1  2002/10/05 10:25:49  arjen
    Creation of gcm_input and a first approach to a web interface
 
 *****************************/
 
-/* static const char *RCSID = "$Id: message.h,v 1.1 2002-10-05 10:25:49 arjen Exp $"; */
+/* static const char *RCSID = "$Id: message.h,v 1.6 2003-04-29 09:16:44 arjen Exp $"; */
 
 #include <iostream>
 #include <list>
 #include <AXE/String.h>
 #include <AXE/date.h>
 
+#include <libxml/parser.h>
+
 #include "database.h"
 
 /*
 //
 //  RELATIONS      :
 //  SEE ALSO       :
-//  LAST MODIFIED  : Sep 30, 2002
+//  LAST MODIFIED  : Nov 04, 2002
 ///////////////////////////////////////////////////////////////////////////
 */
 
 class message_buffer
 {
-   istream       *input;
-   list<String>  buffer;
+   std::istream       *input;
+   std::list<String>  buffer;
 
-   list<String>::iterator   next_line;
+   std::list<String>::iterator   next_line;
 
 public:
 
@@ -69,13 +93,13 @@ public:
       next_line = buffer.begin();
    }
 
-   message_buffer(istream *in)
+   message_buffer(std::istream *in)
    {
       input = in;
       next_line = buffer.begin();
    }
 
-   void from(istream *in)
+   void from(std::istream *in)
    {
       input = in;
    }
@@ -117,7 +141,7 @@ public:
 //
 //  RELATIONS      :
 //  SEE ALSO       :
-//  LAST MODIFIED  : Oct 05, 2002
+//  LAST MODIFIED  : Apr 28, 2003
 ///////////////////////////////////////////////////////////////////////////
 */
 
@@ -130,19 +154,25 @@ class client_message
    bool       mail_header;   //  Does the message contain a mail header ?
    bool       gpg_encrypted; //  Is the message encrypted ?
 
+   xmlDocPtr  xmlDom;
+
    double     certainty;     //  How certain are we about the message
    enum
    {
-      UNKNOWN, SYSLOG, ACCESSLOG, ERRORLOG
+      UNKNOWN, SYSLOG, SYSLOG_IRIX, ACCESSLOG, ERRORLOG, RPMLIST,
+      XML
    }  classification;
 
 
    message_buffer    input;
    gnucomo_database  database;
 
+   int     readXMLinput(String first_line);
+   void    enterXML();
+
 public:
 
-   client_message(istream *in, gnucomo_database db);
+   client_message(std::istream *in, gnucomo_database db);
 
    double classify(String host, UTC arrival = Now(), String serv = "");
    int    enter();