Blame tools/logrecord.h

Packit 1422b7
/* The (in-memory) format of a log record.
Packit 1422b7
 *
Packit 1422b7
 * A log record is sequence of nodes of different syntaxes. A log
Packit 1422b7
 * record is described by a pointer to its root node.
Packit 1422b7
 * The most important node type is literal text, which is always
Packit 1422b7
 * assumed if no other syntax is detected. A full list of syntaxes
Packit 1422b7
 * can be found below.
Packit 1422b7
 *
Packit 1422b7
 * Copyright 2015 Rainer Gerhards
Packit 1422b7
 *
Packit 1422b7
 * Licensed under the Apache License, Version 2.0 (the "License");
Packit 1422b7
 * you may not use this file except in compliance with the License.
Packit 1422b7
 * You may obtain a copy of the License at
Packit 1422b7
 *
Packit 1422b7
 *       http://www.apache.org/licenses/LICENSE-2.0
Packit 1422b7
 *
Packit 1422b7
 * Unless required by applicable law or agreed to in writing, software
Packit 1422b7
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 1422b7
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 1422b7
 * See the License for the specific language governing permissions and
Packit 1422b7
 * limitations under the License.
Packit 1422b7
 */
Packit 1422b7
#ifndef LOGRECORD_H_INCLUDED
Packit 1422b7
#define LOGRECORD_H_INCLUDED
Packit 1422b7
Packit 1422b7
#include <stdint.h>
Packit 1422b7
/* log record node syntaxes
Packit 1422b7
 * This "enumeration" starts at 0 and increments for each new
Packit 1422b7
 * syntax. Note that we do not use an enum type so that we can
Packit 1422b7
 * streamline the in-memory representation. For large sets of
Packit 1422b7
 * log records to be held in main memory, this is important.
Packit 1422b7
 */
Packit 1422b7
#define LRN_SYNTAX_LITERAL_TEXT		0
Packit 1422b7
#define LRN_SYNTAX_IPV4			1
Packit 1422b7
#define LRN_SYNTAX_INT_POSITIVE		2
Packit 1422b7
#define LRN_SYNTAX_DATE_RFC3164		3
Packit 1422b7
Packit 1422b7
struct logrec_node {
Packit 1422b7
	struct logrec_node *next; /* NULL: end of record */
Packit 1422b7
	int8_t ntype;
Packit 1422b7
	union {
Packit 1422b7
		char *ltext; /* the literal text */
Packit 1422b7
		int64_t number; /* all integer types */
Packit 1422b7
	} val;
Packit 1422b7
};
Packit 1422b7
typedef struct logrec_node logrecord_t;
Packit 1422b7
#endif  /* ifndef LOGRECORD_H_INCLUDED */