Mercurial > hg > freeDiameter
annotate extensions/dbg_loglevel/dbg_loglevel_conf.l @ 1554:566bb46cc73f
Updated copyright information
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Tue, 06 Oct 2020 21:34:53 +0800 |
parents | 51a0521cd065 |
children |
rev | line source |
---|---|
1345
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
2 * Software License Agreement (BSD License) * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
3 * Authors: Thomas Klausner <tk@giga.or.at> based on code by Sebastien Decugis <sdecugis@freediameter.net>* |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
4 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
5 * Copyright (c) 2019, Thomas Klausner * |
1554
566bb46cc73f
Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1345
diff
changeset
|
6 * Copyright (c) 2019, WIDE Project and NICT * |
1345
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
7 * All rights reserved. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
8 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
9 * Written under contract by Effortel Technologies SA, http://effortel.com/ * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
10 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
11 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
12 * permitted provided that the following conditions are met: * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
13 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
14 * * Redistributions of source code must retain the above * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
15 * copyright notice, this list of conditions and the * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
16 * following disclaimer. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
17 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
18 * * Redistributions in binary form must reproduce the above * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
19 * copyright notice, this list of conditions and the * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
20 * following disclaimer in the documentation and/or other * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
21 * materials provided with the distribution. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
22 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
23 * * Neither the name of the WIDE Project or NICT nor the * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
24 * names of its contributors may be used to endorse or * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
25 * promote products derived from this software without * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
26 * specific prior written permission of WIDE Project and * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
27 * NICT. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
28 * * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
30 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
35 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
36 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
37 *********************************************************************************************************/ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
38 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
39 /* Tokenizer |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
40 * |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
41 */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
42 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
43 %{ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
44 #include "dbg_loglevel.h" |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
45 #include "dbg_loglevel_conf.tab.h" |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
46 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
47 /* Update the column information */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
48 #define YY_USER_ACTION { \ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
49 yylloc->first_column = yylloc->last_column + 1; \ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
50 yylloc->last_column = yylloc->first_column + yyleng - 1; \ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
51 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
52 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
53 /* Avoid warning with newer flex */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
54 #define YY_NO_INPUT |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
55 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
56 %} |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
57 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
58 qstring \"[^\"\n]*\" |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
59 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
60 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
61 %option bison-bridge bison-locations |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
62 %option noyywrap |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
63 %option nounput |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
64 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
65 %% |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
66 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
67 /* Update the line count */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
68 \n { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
69 yylloc->first_line++; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
70 yylloc->last_line++; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
71 yylloc->last_column=0; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
72 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
73 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
74 /* Eat all spaces but not new lines */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
75 ([[:space:]]{-}[\n])+ ; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
76 /* Eat all comments */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
77 #.*$ ; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
78 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
79 /* Recognize any integer */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
80 [-]?[[:digit:]]+ { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
81 /* Convert this to an integer value */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
82 int ret=0; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
83 ret = sscanf(yytext, "%i", &yylval->integer); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
84 if (ret != 1) { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
85 /* No matching: an error occurred */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
86 TRACE_ERROR("Unable to convert the value '%s' to a valid number: %s", yytext, strerror(errno)); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
87 return LEX_ERROR; /* trig an error in yacc parser */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
88 /* Maybe we could REJECT instead of failing here? */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
89 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
90 return INTEGER; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
91 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
92 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
93 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
94 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
95 /* The key words */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
96 (?i:"LogLevel") { return LOGLEVEL; } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
97 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
98 /* Valid single characters for yyparse */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
99 [=;] { return yytext[0]; } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
100 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
101 /* Unrecognized sequence, if it did not match any previous pattern */ |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
102 [^[:space:]=;\n]+ { |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
103 TRACE_ERROR("Unrecognized text on line %d col %d: '%s'.", yylloc->first_line, yylloc->first_column, yytext); |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
104 return LEX_ERROR; |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
105 } |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
106 |
51a0521cd065
dbg_loglevel: new extension that allows changing the log level at runtime
Thomas Klausner <tk@giga.or.at>
parents:
diff
changeset
|
107 %% |