Different kinds of log files are parsed by a collection of objects
[gnucomo.git] / src / gcm_input / message.h
index 34c8eb8..eb32449 100644 (file)
@@ -8,7 +8,7 @@
 ***********************
 **      FILE NAME      : message.h
 **      SYSTEM NAME    : 
-**      VERSION NUMBER : $Revision: 1.6 $
+**      VERSION NUMBER : $Revision: 1.7 $
 **
 **  DESCRIPTION      :  Classes to for handling client messages
 **
 ********************************
 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
 **      CREATION DATE   : Sep 16, 2002
-**      LAST UPDATE     : Apr 28, 2003
+**      LAST UPDATE     : Aug 06, 2003
 **      MODIFICATIONS   : 
 **************************************************************************/
 
 /*****************************
    $Log: message.h,v $
-   Revision 1.6  2003-04-29 09:16:44  arjen
+   Revision 1.7  2003-08-11 16:56:16  arjen
+   Different kinds of log files are parsed by a collection of objects
+   of different classes, derived from the base class line_cooker
+   Depending on the message content or the message_type element in
+   XML, one of these objects is selected.
+
+   Logrunner is integrated with gcm_input. Although its functionality
+   is still limited, a connection between logrunner and gcm_input
+   is beginning to form.
+
+   Revision 1.6  2003/04/29 09:16:44  arjen
    Read XML input,
    Only cooked log entries for now.
 
@@ -51,7 +61,7 @@
 
 *****************************/
 
-/* static const char *RCSID = "$Id: message.h,v 1.6 2003-04-29 09:16:44 arjen Exp $"; */
+/* static const char *RCSID = "$Id: message.h,v 1.7 2003-08-11 16:56:16 arjen Exp $"; */
 
 #include <iostream>
 #include <list>
@@ -60,6 +70,7 @@
 
 #include <libxml/parser.h>
 
+#include "line_cooker.h"
 #include "database.h"
 
 /*
@@ -141,7 +152,7 @@ public:
 //
 //  RELATIONS      :
 //  SEE ALSO       :
-//  LAST MODIFIED  : Apr 28, 2003
+//  LAST MODIFIED  : Aug 06, 2003
 ///////////////////////////////////////////////////////////////////////////
 */
 
@@ -151,6 +162,9 @@ class client_message
    UTC        arrival;       //  When we got the message.
    String     service;       //  Service that created the message
 
+   std::list<line_cooker *>  kitchen;   //  The collection of line cookers
+   line_cooker           *   pan;       //  The one we cook this log with
+
    bool       mail_header;   //  Does the message contain a mail header ?
    bool       gpg_encrypted; //  Is the message encrypted ?
 
@@ -159,8 +173,7 @@ class client_message
    double     certainty;     //  How certain are we about the message
    enum
    {
-      UNKNOWN, SYSLOG, SYSLOG_IRIX, ACCESSLOG, ERRORLOG, RPMLIST,
-      XML
+      UNKNOWN,  RPMLIST, XML, COOKER_OBJECT
    }  classification;
 
 
@@ -174,6 +187,11 @@ public:
 
    client_message(std::istream *in, gnucomo_database db);
 
+   void   add_cooker(line_cooker *lc)
+   {
+      kitchen.push_back(lc);
+   }
+
    double classify(String host, UTC arrival = Now(), String serv = "");
    int    enter();
 };