provision: add get_dns_{forest,domain}_microsoft_dns_descriptor()
[Samba/id10ts.git] / source3 / include / debugparse.h
bloba66a82a8d882520f70f63684d8648b7349197d30
1 #ifndef DEBUGPARSE_H
2 #define DEBUGPARSE_H
3 /* ========================================================================== **
4 * debugparse.c
6 * Copyright (C) 1998 by Christopher R. Hertel
8 * Email: crh@ubiqx.mn.org
10 * -------------------------------------------------------------------------- **
11 * This module is a very simple parser for Samba debug log files.
12 * -------------------------------------------------------------------------- **
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 3 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library General Public License for more details.
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
27 * -------------------------------------------------------------------------- **
28 * The important function in this module is dbg_char2token(). The rest is
29 * basically fluff. (Potentially useful fluff, but still fluff.)
30 * ========================================================================== **
33 #include "includes.h"
35 /* This module compiles quite nicely outside of the Samba environment.
36 * You'll need the following headers:
37 #include <ctype.h>
38 #include <stdio.h>
39 #include <string.h>
42 /* -------------------------------------------------------------------------- **
43 * These are the tokens returned by dbg_char2token().
46 typedef enum
48 dbg_null = 0,
49 dbg_ignore,
50 dbg_header,
51 dbg_timestamp,
52 dbg_level,
53 dbg_sourcefile,
54 dbg_function,
55 dbg_lineno,
56 dbg_message,
57 dbg_eof
58 } dbg_Token;
60 /* -------------------------------------------------------------------------- **
61 * Function prototypes...
64 const char *dbg_token2string( dbg_Token tok );
65 /* ------------------------------------------------------------------------ **
66 * Given a token, return a string describing the token.
68 * Input: tok - One of the set of dbg_Tokens defined in debugparse.h.
70 * Output: A string identifying the token. This is useful for debugging,
71 * etc.
73 * Note: If the token is not known, this function will return the
74 * string "<unknown>".
76 * ------------------------------------------------------------------------ **
79 dbg_Token dbg_char2token( dbg_Token *state, int c );
80 /* ------------------------------------------------------------------------ **
81 * Parse input one character at a time.
83 * Input: state - A pointer to a token variable. This is used to
84 * maintain the parser state between calls. For
85 * each input stream, you should set up a separate
86 * state variable and initialize it to dbg_null.
87 * Pass a pointer to it into this function with each
88 * character in the input stream. See dbg_test()
89 * for an example.
90 * c - The "current" character in the input stream.
92 * Output: A token.
93 * The token value will change when delimiters are found,
94 * which indicate a transition between syntactical objects.
95 * Possible return values are:
97 * dbg_null - The input character was an end-of-line.
98 * This resets the parser to its initial state
99 * in preparation for parsing the next line.
100 * dbg_eof - Same as dbg_null, except that the character
101 * was an end-of-file.
102 * dbg_ignore - Returned for whitespace and delimiters.
103 * These lexical tokens are only of interest
104 * to the parser.
105 * dbg_header - Indicates the start of a header line. The
106 * input character was '[' and was the first on
107 * the line.
108 * dbg_timestamp - Indicates that the input character was part
109 * of a header timestamp.
110 * dbg_level - Indicates that the input character was part
111 * of the debug-level value in the header.
112 * dbg_sourcefile - Indicates that the input character was part
113 * of the sourcefile name in the header.
114 * dbg_function - Indicates that the input character was part
115 * of the function name in the header.
116 * dbg_lineno - Indicates that the input character was part
117 * of the DEBUG call line number in the header.
118 * dbg_message - Indicates that the input character was part
119 * of the DEBUG message text.
121 * ------------------------------------------------------------------------ **
125 /* -------------------------------------------------------------------------- */
126 #endif /* DEBUGPARSE_H */