root/tags/2.0.0/config.h

Revision 38, 3.4 kB (checked in by jesus, 8 years ago)

use libevent and support C modules

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* ======================================================================
2  * Copyright (c) 2000 Theo Schlossnagle
3  * All rights reserved.
4  * The following code was written by Theo Schlossnagle <jesus@omniti.com>
5  * This code was written to facilitate clustered logging via Spread.
6  * More information on Spread can be found at http://www.spread.org/
7  * Please refer to the LICENSE file before using this software.
8  * ======================================================================
9 */
10
11 #ifndef _CONFIG_H_
12 #define _CONFIG_H_
13
14 #include <stdlib.h>
15 #include <sys/file.h>
16 #ifdef HAVE_GNUREGEX_H
17 #include <gnuregex.h>
18 #else
19 #include <regex.h>
20 #endif
21 #include <sp.h>
22 #include <event.h>
23
24 #include "hash.h"
25 #include "skiplist.h"
26
27 #define SHELL_PATH "/bin/sh"
28
29 typedef struct {
30   char *port;
31   char *host;
32   char private_group[MAX_GROUP_NAME];
33   int connected;
34   Skiplist *logfacilities;
35   int fd;
36   struct event event;
37 } SpreadConfiguration;
38
39 typedef struct {
40   char *filename;
41   int fd;
42 } LogFile;
43
44 typedef struct sld_module_list {
45   char *module_name;
46   struct sld_module_abi *module;
47   struct sld_module_list *next;
48 } sld_module_list_t;
49
50 typedef struct {
51   char *groupname;
52   LogFile *logfile;
53   int nmatches;
54   int rewritetimes;
55   char *rewritetimesformat;
56   regex_t match_expression[10]; /* only up to ten */
57   char *vhostdir;
58   hash_element *hash;
59   char *perl_log_handler;
60   char *perl_hup_handler;
61   char *python_handler;
62   sld_module_list_t *modulelog;
63 } LogFacility;
64
65 int config_init(char *); /* Initialize global structures */
66 void config_cleanup(); /* Initialize global structures */
67
68 char *config_get_spreaddaemon(SpreadConfiguration *);
69 SpreadConfiguration *config_new_spread_conf(void);
70 void config_set_spread_port(SpreadConfiguration *,char *);
71 void config_set_spread_host(SpreadConfiguration *, char *);
72 void config_add_spreadconf(SpreadConfiguration *);
73
74 int config_foreach_spreadconf(int (*)(SpreadConfiguration *, void *), void *);
75
76 LogFacility *config_new_logfacility(void);
77 void config_add_logfacility(SpreadConfiguration *, LogFacility *);
78 void config_set_logfacility_group(LogFacility *, char *);
79 void config_set_logfacility_filename(LogFacility *, char *);
80 void config_set_logfacility_external_perl(LogFacility *, char *);
81 void config_add_logfacility_match(LogFacility *, char *);
82 void config_set_logfacility_external_module(LogFacility *, char *);
83 void config_set_hupfacility_external_perl(LogFacility *, char *);
84 void config_set_logfacility_vhostdir(LogFacility *lf, char *vhd);
85 void config_set_logfaclity_rewritetimes_clf(LogFacility *lf);
86 void config_set_logfaclity_rewritetimes_user(LogFacility *lf, char *format);
87
88 int config_foreach_logfacility(SpreadConfiguration *,
89                                int (*)(LogFacility *, void *), void *);
90 char *config_process_message(SpreadConfiguration *sc, char *group, char *message, int *len);
91 void config_hup(void);  /* config_close(); config_start(); */
92 int config_close(void); /* Close files */
93 int config_start(void); /* Open files and get ready to log */
94
95 int config_get_fd(SpreadConfiguration *sc,
96                   char *group, char *message); /* -1 if no write */
97
98 int config_do_external_module(SpreadConfiguration *sc,
99                   char *sender, char *group, char *message); /* -1 if no write */
100 int config_do_external_perl(SpreadConfiguration *sc,
101                   char *sender, char *group, char *message); /* -1 if no write */
102 #define YYSTYPE MY_YYSTYPE
103 typedef char * MY_YYSTYPE;
104 extern YYSTYPE sld_lval;
105 extern int yysemanticerr;
106
107
108 #endif
109
Note: See TracBrowser for help on using the browser.