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.4 $
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 : Nov 04, 2002
25 **************************************************************************/
27 /*****************************
29 Revision 1.4 2002-12-06 22:26:28 arjen
30 Set the value of log.processed to FALSE when inserting a
31 new log entry into the database
32 When a syslog entry arrives from last year, gcm_input subtracts one from the
33 year of arrival to create the year of the log entry.
34 Read output from "rpm -qa" and enter packages in the parameter table.
36 Revision 1.3 2002/11/09 08:04:27 arjen
37 Added a reference to the GPL
39 Revision 1.2 2002/11/04 10:13:36 arjen
40 Use proper namespace for iostream classes
42 Revision 1.1 2002/10/05 10:25:49 arjen
43 Creation of gcm_input and a first approach to a web interface
45 *****************************/
47 /* static const char *RCSID = "$Id: message.h,v 1.4 2002-12-06 22:26:28 arjen Exp $"; */
51 #include <AXE/String.h>
57 ///////////////////////////////////////////////////////////////////////////
58 // NAME : message_buffer
68 // LAST MODIFIED : Nov 04, 2002
69 ///////////////////////////////////////////////////////////////////////////
75 std::list<String> buffer;
77 std::list<String>::iterator next_line;
84 next_line = buffer.begin();
87 message_buffer(std::istream *in)
90 next_line = buffer.begin();
93 void from(std::istream *in)
98 friend bool operator >> (message_buffer &, String &);
102 next_line = buffer.begin();
107 if (next_line != buffer.end())
115 if (next_line != buffer.begin())
123 ///////////////////////////////////////////////////////////////////////////
124 // NAME : client_message
128 // METHODS : classify()
135 // LAST MODIFIED : Nov 04, 2002
136 ///////////////////////////////////////////////////////////////////////////
141 String hostname; // Where the message came from (FQDN)
142 UTC arrival; // When we got the message.
143 String service; // Service that created the message
145 bool mail_header; // Does the message contain a mail header ?
146 bool gpg_encrypted; // Is the message encrypted ?
148 double certainty; // How certain are we about the message
151 UNKNOWN, SYSLOG, ACCESSLOG, ERRORLOG, RPMLIST
155 message_buffer input;
156 gnucomo_database database;
160 client_message(std::istream *in, gnucomo_database db);
162 double classify(String host, UTC arrival = Now(), String serv = "");