|
Packit |
1422b7 |
/**
|
|
Packit |
1422b7 |
* @file lognorm.h
|
|
Packit |
1422b7 |
* @brief Private data structures used by the liblognorm API.
|
|
Packit |
1422b7 |
*//*
|
|
Packit |
1422b7 |
*
|
|
Packit |
1422b7 |
* liblognorm - a fast samples-based log normalization library
|
|
Packit |
1422b7 |
* Copyright 2010 by Rainer Gerhards and Adiscon GmbH.
|
|
Packit |
1422b7 |
*
|
|
Packit |
1422b7 |
* This file is part of liblognorm.
|
|
Packit |
1422b7 |
*
|
|
Packit |
1422b7 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
1422b7 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
1422b7 |
* License as published by the Free Software Foundation; either
|
|
Packit |
1422b7 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
1422b7 |
*
|
|
Packit |
1422b7 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
1422b7 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
1422b7 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
1422b7 |
* Lesser General Public License for more details.
|
|
Packit |
1422b7 |
*
|
|
Packit |
1422b7 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
1422b7 |
* License along with this library; if not, write to the Free Software
|
|
Packit |
1422b7 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
1422b7 |
*
|
|
Packit |
1422b7 |
* A copy of the LGPL v2.1 can be found in the file "COPYING" in this distribution.
|
|
Packit |
1422b7 |
*/
|
|
Packit |
1422b7 |
#ifndef LIBLOGNORM_LOGNORM_HINCLUDED
|
|
Packit |
1422b7 |
#define LIBLOGNORM_LOGNORM_HINCLUDED
|
|
Packit |
1422b7 |
#include <stdlib.h> /* we need size_t */
|
|
Packit |
1422b7 |
#include "liblognorm.h"
|
|
Packit |
1422b7 |
#include "pdag.h"
|
|
Packit |
1422b7 |
#include "annot.h"
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
/* some limits */
|
|
Packit |
1422b7 |
#define MAX_FIELDNAME_LEN 1024
|
|
Packit |
1422b7 |
#define MAX_TYPENAME_LEN 1024
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
#define LN_ObjID_None 0xFEFE0001
|
|
Packit |
1422b7 |
#define LN_ObjID_CTX 0xFEFE0001
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
struct ln_type_pdag {
|
|
Packit |
1422b7 |
const char *name;
|
|
Packit |
1422b7 |
ln_pdag *pdag;
|
|
Packit |
1422b7 |
};
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
struct ln_ctx_s {
|
|
Packit |
1422b7 |
unsigned objID; /**< a magic number to prevent some memory addressing errors */
|
|
Packit |
1422b7 |
void (*dbgCB)(void *cookie, const char *msg, size_t lenMsg);
|
|
Packit |
1422b7 |
/**< user-provided debug output callback */
|
|
Packit |
1422b7 |
void *dbgCookie; /**< cookie to be passed to debug callback */
|
|
Packit |
1422b7 |
void (*errmsgCB)(void *cookie, const char *msg, size_t lenMsg);
|
|
Packit |
1422b7 |
/**< user-provided error message callback */
|
|
Packit |
1422b7 |
void *errmsgCookie; /**< cookie to be passed to error message callback */
|
|
Packit |
1422b7 |
ln_pdag *pdag; /**< parse dag being used by this context */
|
|
Packit |
1422b7 |
ln_annotSet *pas; /**< associated set of annotations */
|
|
Packit |
1422b7 |
unsigned nNodes; /**< number of nodes in our parse tree */
|
|
Packit |
1422b7 |
unsigned char debug; /**< boolean: are we in debug mode? */
|
|
Packit |
1422b7 |
es_str_t *rulePrefix; /**< work variable for loading rule bases
|
|
Packit |
1422b7 |
* this is the prefix string that will be prepended
|
|
Packit |
1422b7 |
* to all rules before they are submitted to tree
|
|
Packit |
1422b7 |
* building.
|
|
Packit |
1422b7 |
*/
|
|
Packit |
1422b7 |
unsigned opts; /**< specific options, see LN_CTXOPTS_* defines */
|
|
Packit |
1422b7 |
struct ln_type_pdag *type_pdags; /**< array of our type pdags */
|
|
Packit |
1422b7 |
int nTypes; /**< number of type pdags */
|
|
Packit |
1422b7 |
int version; /**< 1 or 2, depending on rulebase/algo version */
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
/* here follows stuff for the v1 subsystem -- do NOT make any changes
|
|
Packit |
1422b7 |
* down here. This is strictly read-only. May also be removed some time in
|
|
Packit |
1422b7 |
* the future.
|
|
Packit |
1422b7 |
*/
|
|
Packit |
1422b7 |
struct ln_ptree *ptree;
|
|
Packit |
1422b7 |
/* end old cruft */
|
|
Packit |
1422b7 |
/* things for config processing / error message during it */
|
|
Packit |
1422b7 |
int include_level; /**< 1 for main rulebase file, higher for include levels */
|
|
Packit |
1422b7 |
const char *conf_file; /**< currently open config file or NULL, if none */
|
|
Packit |
1422b7 |
unsigned int conf_ln_nbr; /**< current config file line number */
|
|
Packit |
1422b7 |
};
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
void ln_dbgprintf(ln_ctx ctx, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
|
Packit |
1422b7 |
void ln_errprintf(ln_ctx ctx, const int eno, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
|
|
Packit |
1422b7 |
|
|
Packit |
1422b7 |
#define LN_DBGPRINTF(ctx, ...) if(ctx->dbgCB != NULL) { ln_dbgprintf(ctx, __VA_ARGS__); }
|
|
Packit |
1422b7 |
//#define LN_DBGPRINTF(ctx, ...)
|
|
Packit |
1422b7 |
#endif /* #ifndef LIBLOGNORM_LOGNORM_HINCLUDED */
|