2
* basiclog.h - basic DataLog classes
3
* $Id: basiclog.h,v 1.8 2003/01/26 09:09:07 rdenisc Exp $
6
/***********************************************************************
7
* Copyright (C) 2002-2003 R�mi Denis-Courmont. *
8
* This program is free software; you can redistribute and/or modify *
9
* it under the terms of the GNU General Public License as published *
10
* by the Free Software Foundation; version 2 of the license. *
12
* This program is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15
* See the GNU General Public License for more details. *
17
* You should have received a copy of the GNU General Pulic License *
18
* along with this program; if not, you can get it from: *
19
* http://www.gnu.org/copyleft/gpl.html *
20
***********************************************************************/
22
#ifndef __TCPREEN_BASICLOG_H
24
# define __TCPREEN_BASICLOG_H
28
* Base class for all basic log formats
30
class BasicDataLog : public DataLog
33
int (*logwrite) (const void *, int, FILE *);
34
long incount, outcount;
37
BasicDataLog (int (*logfunc) (const void *, int, FILE *)) :
38
DataLog (), logwrite (logfunc),
39
incount (0), outcount (0)
42
virtual ~BasicDataLog (void);
44
void Connect (const char *server, const char *client);
45
int WriteServerData (const void *data, int length, int oob);
46
int WriteClientData (const void *data, int length, int oob);
47
void ShutdownServer (void);
48
void ShutdownClient (void);
51
template <int (*fwrite_func) (const void *, int, FILE *)>
52
class TemplateBasicDataLog : public BasicDataLog
55
TemplateBasicDataLog <fwrite_func> (void) :
56
BasicDataLog (fwrite_func)
64
typedef TemplateBasicDataLog<fwrite_count> CountDataLog;
65
typedef TemplateBasicDataLog<fwrite_C> CDataLog;
66
typedef TemplateBasicDataLog<fwrite_hex> HexDataLog;
67
typedef TemplateBasicDataLog<fwrite_raw> RawDataLog;
68
typedef TemplateBasicDataLog<fwrite_strip> StrippedDataLog;
71
* Makers for the above classes
73
extern DataLog *CountDataLogMaker (void);
74
extern DataLog *CDataLogMaker (void);
75
extern DataLog *HexDataLogMaker (void);
76
extern DataLog *RawDataLogMaker (void);
77
extern DataLog *StrippedDataLogMaker (void);
79
#endif /* ifndef __TCPREEN_BASICLOG_H */