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