2 /**************************************************************************
3 ** (c) Copyright 2002, Andromeda Technology & Automation
4 ** This is free software; you can redistribute it and/or modify it under the
5 ** terms of the GNU General Public License, see the file COPYING.
6 ***************************************************************************
7 ** MODULE INFORMATION *
8 ***********************
9 ** FILE NAME : message.h
11 ** VERSION NUMBER : $Revision: 1.6 $
13 ** DESCRIPTION : Classes to for handling client messages
18 ***************************************************************************
19 ** ADMINISTRATIVE INFORMATION *
20 ********************************
21 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
22 ** CREATION DATE : Sep 16, 2002
23 ** LAST UPDATE : Apr 28, 2003
25 **************************************************************************/
27 /*****************************
29 Revision 1.6 2003-04-29 09:16:44 arjen
31 Only cooked log entries for now.
33 Revision 1.5 2003/03/16 09:42:40 arjen
34 Read IRIX system logs.
36 Revision 1.4 2002/12/06 22:26:28 arjen
37 Set the value of log.processed to FALSE when inserting a
38 new log entry into the database
39 When a syslog entry arrives from last year, gcm_input subtracts one from the
40 year of arrival to create the year of the log entry.
41 Read output from "rpm -qa" and enter packages in the parameter table.
43 Revision 1.3 2002/11/09 08:04:27 arjen
44 Added a reference to the GPL
46 Revision 1.2 2002/11/04 10:13:36 arjen
47 Use proper namespace for iostream classes
49 Revision 1.1 2002/10/05 10:25:49 arjen
50 Creation of gcm_input and a first approach to a web interface
52 *****************************/
54 /* static const char *RCSID = "$Id: message.h,v 1.6 2003-04-29 09:16:44 arjen Exp $"; */
58 #include <AXE/String.h>
61 #include <libxml/parser.h>
66 ///////////////////////////////////////////////////////////////////////////
67 // NAME : message_buffer
77 // LAST MODIFIED : Nov 04, 2002
78 ///////////////////////////////////////////////////////////////////////////
84 std::list<String> buffer;
86 std::list<String>::iterator next_line;
93 next_line = buffer.begin();
96 message_buffer(std::istream *in)
99 next_line = buffer.begin();
102 void from(std::istream *in)
107 friend bool operator >> (message_buffer &, String &);
111 next_line = buffer.begin();
116 if (next_line != buffer.end())
124 if (next_line != buffer.begin())
132 ///////////////////////////////////////////////////////////////////////////
133 // NAME : client_message
137 // METHODS : classify()
144 // LAST MODIFIED : Apr 28, 2003
145 ///////////////////////////////////////////////////////////////////////////
150 String hostname; // Where the message came from (FQDN)
151 UTC arrival; // When we got the message.
152 String service; // Service that created the message
154 bool mail_header; // Does the message contain a mail header ?
155 bool gpg_encrypted; // Is the message encrypted ?
159 double certainty; // How certain are we about the message
162 UNKNOWN, SYSLOG, SYSLOG_IRIX, ACCESSLOG, ERRORLOG, RPMLIST,
167 message_buffer input;
168 gnucomo_database database;
170 int readXMLinput(String first_line);
175 client_message(std::istream *in, gnucomo_database db);
177 double classify(String host, UTC arrival = Now(), String serv = "");