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.5 $
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 : Feb 28, 2003
25 **************************************************************************/
27 /*****************************
29 Revision 1.5 2003-03-16 09:42:40 arjen
30 Read IRIX system logs.
32 Revision 1.4 2002/12/06 22:26:28 arjen
33 Set the value of log.processed to FALSE when inserting a
34 new log entry into the database
35 When a syslog entry arrives from last year, gcm_input subtracts one from the
36 year of arrival to create the year of the log entry.
37 Read output from "rpm -qa" and enter packages in the parameter table.
39 Revision 1.3 2002/11/09 08:04:27 arjen
40 Added a reference to the GPL
42 Revision 1.2 2002/11/04 10:13:36 arjen
43 Use proper namespace for iostream classes
45 Revision 1.1 2002/10/05 10:25:49 arjen
46 Creation of gcm_input and a first approach to a web interface
48 *****************************/
50 /* static const char *RCSID = "$Id: message.h,v 1.5 2003-03-16 09:42:40 arjen Exp $"; */
54 #include <AXE/String.h>
60 ///////////////////////////////////////////////////////////////////////////
61 // NAME : message_buffer
71 // LAST MODIFIED : Nov 04, 2002
72 ///////////////////////////////////////////////////////////////////////////
78 std::list<String> buffer;
80 std::list<String>::iterator next_line;
87 next_line = buffer.begin();
90 message_buffer(std::istream *in)
93 next_line = buffer.begin();
96 void from(std::istream *in)
101 friend bool operator >> (message_buffer &, String &);
105 next_line = buffer.begin();
110 if (next_line != buffer.end())
118 if (next_line != buffer.begin())
126 ///////////////////////////////////////////////////////////////////////////
127 // NAME : client_message
131 // METHODS : classify()
138 // LAST MODIFIED : Feb 28, 2003
139 ///////////////////////////////////////////////////////////////////////////
144 String hostname; // Where the message came from (FQDN)
145 UTC arrival; // When we got the message.
146 String service; // Service that created the message
148 bool mail_header; // Does the message contain a mail header ?
149 bool gpg_encrypted; // Is the message encrypted ?
151 double certainty; // How certain are we about the message
154 UNKNOWN, SYSLOG, SYSLOG_IRIX, ACCESSLOG, ERRORLOG, RPMLIST
158 message_buffer input;
159 gnucomo_database database;
163 client_message(std::istream *in, gnucomo_database db);
165 double classify(String host, UTC arrival = Now(), String serv = "");