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.3 $
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.3 2002-11-09 08:04:27 arjen
30 Added a reference to the GPL
32 Revision 1.2 2002/11/04 10:13:36 arjen
33 Use proper namespace for iostream classes
35 Revision 1.1 2002/10/05 10:25:49 arjen
36 Creation of gcm_input and a first approach to a web interface
38 *****************************/
40 /* static const char *RCSID = "$Id: message.h,v 1.3 2002-11-09 08:04:27 arjen Exp $"; */
44 #include <AXE/String.h>
50 ///////////////////////////////////////////////////////////////////////////
51 // NAME : message_buffer
61 // LAST MODIFIED : Nov 04, 2002
62 ///////////////////////////////////////////////////////////////////////////
68 std::list<String> buffer;
70 std::list<String>::iterator next_line;
77 next_line = buffer.begin();
80 message_buffer(std::istream *in)
83 next_line = buffer.begin();
86 void from(std::istream *in)
91 friend bool operator >> (message_buffer &, String &);
95 next_line = buffer.begin();
100 if (next_line != buffer.end())
108 if (next_line != buffer.begin())
116 ///////////////////////////////////////////////////////////////////////////
117 // NAME : client_message
121 // METHODS : classify()
128 // LAST MODIFIED : Nov 04, 2002
129 ///////////////////////////////////////////////////////////////////////////
134 String hostname; // Where the message came from (FQDN)
135 UTC arrival; // When we got the message.
136 String service; // Service that created the message
138 bool mail_header; // Does the message contain a mail header ?
139 bool gpg_encrypted; // Is the message encrypted ?
141 double certainty; // How certain are we about the message
144 UNKNOWN, SYSLOG, ACCESSLOG, ERRORLOG
148 message_buffer input;
149 gnucomo_database database;
153 client_message(std::istream *in, gnucomo_database db);
155 double classify(String host, UTC arrival = Now(), String serv = "");