Major redesign. All input is handled through XML. Raw input data is first
[gnucomo.git] / src / gcm_input / message_filter.h
1
2 /**************************************************************************
3 **  (c) Copyright 2003, 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_filter.h
10 **      SYSTEM NAME    : 
11 **      VERSION NUMBER : $Revision: 1.1 $
12 **
13 **  DESCRIPTION      :  
14 **
15 **  EXPORTED OBJECTS : 
16 **  LOCAL    OBJECTS : 
17 **  MODULES  USED    :
18 ***************************************************************************
19 **  ADMINISTRATIVE INFORMATION *
20 ********************************
21 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
22 **      CREATION DATE   : Nov 26, 2003
23 **      LAST UPDATE     : Nov 26, 2003
24 **      MODIFICATIONS   : 
25 **************************************************************************/
26
27 /*****************************
28    $Log: message_filter.h,v $
29    Revision 1.1  2003-12-04 10:38:09  arjen
30    Major redesign. All input is handled through XML. Raw input data is first
31    transformed into an XML document for further processing.
32    A collection of polymorphic classes handle the transformation of various
33    input formats into XML.
34    Classifying input data is done with a finite improbability calculation.
35
36 *****************************/
37
38 /* static const char *RCSID = "$Id: message_filter.h,v 1.1 2003-12-04 10:38:09 arjen Exp $"; */
39
40 #ifndef MESSAGE_FILTER_H
41 #define MESSAGE_FILTER_H
42
43 #include <strstream>
44
45 #include <AXE/String.h>
46 #include <AXE/date.h>
47
48 #include "message_buffer.h"
49
50 /*
51 ///////////////////////////////////////////////////////////////////////////
52 //  NAME           : message_filter
53 //  BASECLASS      : 
54 //  MEMBERS        :
55 //  OPERATORS      :
56 //  METHODS        : contruct_XML
57 //                   set_message_type
58 //
59 //  DESCRIPTION    : Transform any kind of input into an XML document
60 //                   for Gnucomo
61 //
62 //  RELATIONS      :
63 //  SEE ALSO       :
64 //  LAST MODIFIED  : Nov 26, 2003
65 ///////////////////////////////////////////////////////////////////////////
66 */
67
68 class message_filter
69 {
70
71 protected:
72
73    UTC    ts;     //    the timestamp.
74    String hn;     //    the hostname
75    String srv;    //    the service
76    String mt;     //    the message type
77
78    void scan_email_header(message_buffer &in);
79    void construct_header(std::strstream &xml);
80
81 public:
82
83    message_filter(String host, UTC arriv, String service)
84    {
85       hn  = host;
86       ts  = arriv;
87       srv = service;
88    }
89
90    virtual void construct_XML(message_buffer &in, std::strstream &xml);
91
92    void set_message_type(String msgt)
93    {
94       mt = msgt;
95    }
96 };
97
98 #endif // MESSAGE_FILTER_H