2 /**************************************************************************
3 ** (c) Copyright 2002, Andromeda Technology & Automation
4 ***************************************************************************
5 ** MODULE INFORMATION *
6 ***********************
7 ** FILE NAME : message.h
9 ** VERSION NUMBER : $Revision: 1.2 $
11 ** DESCRIPTION : Classes to for handling client messages
16 ***************************************************************************
17 ** ADMINISTRATIVE INFORMATION *
18 ********************************
19 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
20 ** CREATION DATE : Sep 16, 2002
21 ** LAST UPDATE : Nov 04, 2002
23 **************************************************************************/
25 /*****************************
27 Revision 1.2 2002-11-04 10:13:36 arjen
28 Use proper namespace for iostream classes
30 Revision 1.1 2002/10/05 10:25:49 arjen
31 Creation of gcm_input and a first approach to a web interface
33 *****************************/
35 /* static const char *RCSID = "$Id: message.h,v 1.2 2002-11-04 10:13:36 arjen Exp $"; */
39 #include <AXE/String.h>
45 ///////////////////////////////////////////////////////////////////////////
46 // NAME : message_buffer
56 // LAST MODIFIED : Nov 04, 2002
57 ///////////////////////////////////////////////////////////////////////////
63 std::list<String> buffer;
65 std::list<String>::iterator next_line;
72 next_line = buffer.begin();
75 message_buffer(std::istream *in)
78 next_line = buffer.begin();
81 void from(std::istream *in)
86 friend bool operator >> (message_buffer &, String &);
90 next_line = buffer.begin();
95 if (next_line != buffer.end())
103 if (next_line != buffer.begin())
111 ///////////////////////////////////////////////////////////////////////////
112 // NAME : client_message
116 // METHODS : classify()
123 // LAST MODIFIED : Nov 04, 2002
124 ///////////////////////////////////////////////////////////////////////////
129 String hostname; // Where the message came from (FQDN)
130 UTC arrival; // When we got the message.
131 String service; // Service that created the message
133 bool mail_header; // Does the message contain a mail header ?
134 bool gpg_encrypted; // Is the message encrypted ?
136 double certainty; // How certain are we about the message
139 UNKNOWN, SYSLOG, ACCESSLOG, ERRORLOG
143 message_buffer input;
144 gnucomo_database database;
148 client_message(std::istream *in, gnucomo_database db);
150 double classify(String host, UTC arrival = Now(), String serv = "");