blob: 31beb293b3093c805293ffc7f8e173016fd89786 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#ifndef _ULOGD_H
#define _ULOGD_H
/* ulogd, Version $Revision: 1.4 $
*
* first try of a logging daemon for my netfilter ULOG target
* for the linux 2.4 netfilter subsystem.
*
* (C) 2000 by Harald Welte <laforge@sunbeam.franken.de>
*
* this code is released under the terms of GNU GPL
*
* $Id: ulogd.h,v 1.4 2000/08/14 08:28:24 laforge Exp $
*/
#include <libipulog/libipulog.h>
/* All types with MSB = 1 make use of value.ptr
* other types use one of the union's member */
/* types without length */
#define ULOGD_RET_NONE 0x0000
#define ULOGD_RET_INT8 0x0001
#define ULOGD_RET_INT16 0x0002
#define ULOGD_RET_INT32 0x0003
#define ULOGD_RET_INT64 0x0004
#define ULOGD_RET_UINT8 0x0011
#define ULOGD_RET_UINT16 0x0012
#define ULOGD_RET_UINT32 0x0013
#define ULOGD_RET_UINT64 0x0014
#define ULOGD_RET_BOOL 0x0050
#define ULOGD_RET_IPADDR 0x0100
/* types with lenght field*/
#define ULOGD_RET_STRING 0x8020
#define ULODG_RET_RAW 0x8030
#define ULOGD_RET_OTHER 0xffff
#define ULOGD_MAX_KEYLEN 32
#define ulogd_error(format, args...) ulogd_log(8, format, ## args)
extern FILE *logfile;
typedef struct ulog_iret {
struct ulog_iret *next;
u_int32_t len;
u_int16_t type;
char key[ULOGD_MAX_KEYLEN];
union {
u_int8_t b;
u_int8_t ui8;
u_int16_t ui16;
u_int32_t ui32;
u_int64_t ui64;
int8_t i8;
int16_t i16;
int32_t i32;
int64_t i64;
void *ptr;
} value;
} ulog_iret_t;
typedef struct ulog_interpreter {
struct ulog_interpreter *next;
char name[ULOGD_MAX_KEYLEN];
ulog_iret_t* (*interp)(ulog_packet_msg_t *pkt);
} ulog_interpreter_t;
typedef struct ulog_output {
struct ulog_output *next;
char name[ULOGD_MAX_KEYLEN];
int* (*output)(ulog_iret_t *ret);
} ulog_output_t;
/***********************************************************************
* PUBLIC INTERFACE
***********************************************************************/
/* register a new interpreter plugin */
void register_interpreter(ulog_interpreter_t *me);
/* register a new output target */
void register_output(ulog_output_t *me);
/* allocate a new ulog_iret_t */
ulog_iret_t *alloc_ret(const u_int16_t type, const char*);
/* write a message to the daemons' logfile */
void ulogd_log(int level, const char *message, ...);
#endif
|