root/tags/v_1_5_0/config.h

Revision 31, 2.9 kB (checked in by jesus, 11 years ago)

pyhton handler

  • 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
23 #include "hash.h"
24 #include "skiplist.h"
25
26 #define SHELL_PATH "/bin/sh"
27
28 typedef struct {
29   char *port;
30   char *host;
31   char private_group[MAX_GROUP_NAME];
32   int connected;
33   Skiplist *logfacilities;
34 } SpreadConfiguration;
35
36 typedef struct {
37   char *filename;
38   int fd;
39 } LogFile;
40
41
42 typedef struct {
43   char *groupname;
44   LogFile *logfile;
45   int nmatches;
46   int rewritetimes;
47   char *rewritetimesformat;
48   regex_t match_expression[10]; /* only up to ten */
49   char *vhostdir;
50   hash_element *hash;
51   char *perl_handler;
52   char *python_handler;
53 } LogFacility;
54
55 int config_init(char *); /* Initialize global structures */
56 void config_cleanup(); /* Initialize global structures */
57
58 char *config_get_spreaddaemon(SpreadConfiguration *);
59 SpreadConfiguration *config_new_spread_conf(void);
60 void config_set_spread_port(SpreadConfiguration *,char *);
61 void config_set_spread_host(SpreadConfiguration *, char *);
62 void config_add_spreadconf(SpreadConfiguration *);
63
64 int config_foreach_spreadconf(int (*)(SpreadConfiguration *, void *), void *);
65
66 LogFacility *config_new_logfacility(void);
67 void config_add_logfacility(SpreadConfiguration *, LogFacility *);
68 void config_set_logfacility_group(LogFacility *, char *);
69 void config_set_logfacility_filename(LogFacility *, char *);
70 void config_set_logfacility_external_perl(LogFacility *, char *);
71 void config_add_logfacility_match(LogFacility *, char *);
72 void config_set_logfacility_vhostdir(LogFacility *lf, char *vhd);
73 void config_set_logfaclity_rewritetimes_clf(LogFacility *lf);
74 void config_set_logfaclity_rewritetimes_user(LogFacility *lf, char *format);
75
76 int config_foreach_logfacility(SpreadConfiguration *,
77                                int (*)(LogFacility *, void *), void *);
78 char *config_process_message(SpreadConfiguration *sc, char *group, char *message, int *len);
79 void config_hup(void);  /* config_close(); config_start(); */
80 int config_close(void); /* Close files */
81 int config_start(void); /* Open files and get ready to log */
82
83 int config_get_fd(SpreadConfiguration *sc,
84                   char *group, char *message); /* -1 if no write */
85
86 int config_do_external_perl(SpreadConfiguration *sc,
87                   char *sender, char *group, char *message); /* -1 if no write */
88 #define YYSTYPE MY_YYSTYPE
89 typedef char * MY_YYSTYPE;
90 extern YYSTYPE sld_lval;
91 extern int yysemanticerr;
92
93
94 #endif
95
Note: See TracBrowser for help on using the browser.