2 * Copyright (c) 1997 Joerg Wunsch. All rights reserved.
4 * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 *---------------------------------------------------------------------------
30 * i4b daemon - runtime configuration parser
31 * -----------------------------------------
33 * $Id: rc_parse.y,v 1.6 2009/04/16 05:56:32 lukem Exp $
37 * last edit-date: [Mon Oct 2 22:51:23 2000]
39 *---------------------------------------------------------------------------*/
43 /* #define YYDEBUG 1 */
49 #include "monitor.h" /* monitor access rights bit definitions */
60 extern
void cfg_setval
(int keyword
);
61 extern
void init_currrent_cfg_state
(void);
62 extern
void reset_scanner
(FILE *infile
);
63 extern
void yyerror(const char *msg
);
64 extern
int yylex(void);
65 extern
void flush_config
(void);
70 extern
struct isdn_ctrl_state
* cur_ctrl
;
84 %token BUDGETCALLOUTPERIOD
85 %token BUDGETCALLOUTNCALLS
86 %token BUDGETCALLOUTSFILE
87 %token BUDGETCALLOUTSFILEROTATE
88 %token BUDGETCALLBACKPERIOD
89 %token BUDGETCALLBACKNCALLS
90 %token BUDGETCALLBACKSFILE
91 %token BUDGETCALLBACKSFILEROTATE
103 %token DISCONNECTPROG
116 %token ISDNCONTROLLER
120 %token LOCAL_PHONE_DIALOUT
121 %token LOCAL_PHONE_INCOMING
133 %token PPP_AUTH_RECHALLENGE
134 %token PPP_AUTH_PARANOID
135 %token PPP_EXPECT_AUTH
136 %token PPP_EXPECT_NAME
137 %token PPP_EXPECT_PASSWORD
140 %token PPP_SEND_PASSWORD
148 %token REMOTE_NUMBERS_HANDLING
149 %token REMOTE_PHONE_DIALOUT
150 %token REMOTE_PHONE_INCOMING
166 %token
<str
> NUMBERSTR
170 %type
<booln
> boolean
172 %type
<num
> sysfilekeyword sysnumkeyword sysstrkeyword sysboolkeyword
173 %type
<num
> filekeyword numkeyword strkeyword boolkeyword monrights monright
174 %type
<num
> cstrkeyword cfilekeyword
191 sections: possible_nullentries
197 possible_nullentries:
199 | possible_nullentries
error '\n'
200 | possible_nullentries nullentry
206 optentrysects: entrysects
210 entrysects: entrysect
211 | entrysects entrysect
219 controllersects: controllersect
220 | controllersects controllersect
227 syssect: SYSTEM sysentries
233 monitor_clear_rights
();
235 | sysentries sysentry
238 sysentry: sysfileentry
250 MONITOR
'=' STRING
'\n'
252 const char *err
= NULL
;
253 switch
(monitor_start_rights
($3)) {
257 err
= "local socket name too long: %s";
260 err
= "duplicate entry: %s";
263 err
= "invalid CIDR specification: %s";
266 err
= "could not resolve host or net specification: %s";
271 snprintf
(msg
, sizeof msg
, err
, $3);
278 MONITORACCESS
'=' monrights
'\n'
279 { monitor_add_rights
($3); }
282 monrights: monrights
',' monright
{ $$
= $1 |
$3; }
283 | monright
{ $$
= $1; }
286 monright: FULLCMD
{ $$
= I4B_CA_COMMAND_FULL
; }
287 | RESTRICTEDCMD
{ $$
= I4B_CA_COMMAND_RESTRICTED
; }
288 | CHANNELSTATE
{ $$
= I4B_CA_EVNT_CHANSTATE
; }
289 | CALLIN
{ $$
= I4B_CA_EVNT_CALLIN
; }
290 | CALLOUT
{ $$
= I4B_CA_EVNT_CALLOUT
; }
291 | LOGEVENTS
{ $$
= I4B_CA_EVNT_I4B
; }
294 sysfileentry: sysfilekeyword
'=' filename
'\n'
300 sysboolentry: sysboolkeyword
'=' boolean
'\n'
307 sysnumentry: sysnumkeyword
'=' NUMBERSTR
'\n'
309 yylval.num
= atoi
($3);
314 sysstrentry: sysstrkeyword
'=' STRING
'\n'
318 | sysstrkeyword
'=' NUMBERSTR
'\n'
327 yyerror("filename doesn't start with a slash");
334 boolean: NO
{ $$
= FALSE
; }
335 | OFF
{ $$
= FALSE
; }
340 sysfilekeyword: RATESFILE
{ $$
= RATESFILE
; }
341 | ACCTFILE
{ $$
= ACCTFILE
; }
342 | ALIASFNAME
{ $$
= ALIASFNAME
; }
343 | HOLIDAYFILE
{ $$
= HOLIDAYFILE
; }
344 | TINAINITPROG
{ $$
= TINAINITPROG
; }
347 sysboolkeyword: USEACCTFILE
{ $$
= USEACCTFILE
; }
348 | ALIASING
{ $$
= ALIASING
; }
349 | ACCTALL
{ $$
= ACCTALL
; }
350 | BEEPCONNECT
{ $$
= BEEPCONNECT
; }
351 | EXTCALLATTR
{ $$
= EXTCALLATTR
; }
352 | ISDNTIME
{ $$
= ISDNTIME
; }
353 | MONITORSW
{ $$
= MONITORSW
; }
356 sysnumkeyword: MONITORPORT
{ $$
= MONITORPORT
; }
357 | RTPRIO
{ $$
= RTPRIO
; }
360 sysstrkeyword: MAILER
{ $$
= MAILER
; }
361 | MAILTO
{ $$
= MAILTO
; }
362 | ROTATESUFFIX
{ $$
= ROTATESUFFIX
; }
363 | REGEXPR
{ $$
= REGEXPR
; }
364 | REGPROG
{ $$
= REGPROG
; }
373 init_currrent_cfg_state
();
390 fileentry: filekeyword
'=' filename
'\n'
397 strentry: strkeyword
'=' STRING
'\n'
401 | strkeyword
'=' NUMBERSTR
'\n'
407 boolentry: boolkeyword
'=' boolean
'\n'
414 numentry: numkeyword
'=' NUMBERSTR
'\n'
416 yylval.num
= atoi
($3);
421 filekeyword: BUDGETCALLBACKSFILE
{ $$
= BUDGETCALLBACKSFILE
; }
422 | BUDGETCALLOUTSFILE
{ $$
= BUDGETCALLOUTSFILE
; }
425 strkeyword: ANSWERPROG
{ $$
= ANSWERPROG
; }
426 | B1PROTOCOL
{ $$
= B1PROTOCOL
; }
427 | CONNECTPROG
{ $$
= CONNECTPROG
; }
428 | DIALOUTTYPE
{ $$
= DIALOUTTYPE
; }
429 | DIRECTION
{ $$
= DIRECTION
; }
430 | DISCONNECTPROG
{ $$
= DISCONNECTPROG
; }
431 | IDLE_ALG_OUT
{ $$
= IDLE_ALG_OUT
; }
432 | LOCAL_PHONE_INCOMING
{ $$
= LOCAL_PHONE_INCOMING
; }
433 | LOCAL_PHONE_DIALOUT
{ $$
= LOCAL_PHONE_DIALOUT
; }
434 | NAME
{ $$
= NAME
; }
435 | PPP_EXPECT_AUTH
{ $$
= PPP_EXPECT_AUTH
; }
436 | PPP_EXPECT_NAME
{ $$
= PPP_EXPECT_NAME
; }
437 | PPP_EXPECT_PASSWORD
{ $$
= PPP_EXPECT_PASSWORD
; }
438 | PPP_SEND_AUTH
{ $$
= PPP_SEND_AUTH
; }
439 | PPP_SEND_NAME
{ $$
= PPP_SEND_NAME
; }
440 | PPP_SEND_PASSWORD
{ $$
= PPP_SEND_PASSWORD
; }
441 | REACTION
{ $$
= REACTION
; }
442 | REMOTE_NUMBERS_HANDLING
{ $$
= REMOTE_NUMBERS_HANDLING
; }
443 | REMOTE_PHONE_INCOMING
{ $$
= REMOTE_PHONE_INCOMING
; }
444 | REMOTE_PHONE_DIALOUT
{ $$
= REMOTE_PHONE_DIALOUT
; }
445 | UNITLENGTHSRC
{ $$
= UNITLENGTHSRC
; }
446 | USRDEVICENAME
{ $$
= USRDEVICENAME
; }
447 | VALID
{ $$
= VALID
; }
450 numkeyword: ALERT
{ $$
= ALERT
; }
451 | BUDGETCALLBACKPERIOD
{ $$
= BUDGETCALLBACKPERIOD
; }
452 | BUDGETCALLBACKNCALLS
{ $$
= BUDGETCALLBACKNCALLS
; }
453 | BUDGETCALLOUTPERIOD
{ $$
= BUDGETCALLOUTPERIOD
; }
454 | BUDGETCALLOUTNCALLS
{ $$
= BUDGETCALLOUTNCALLS
; }
455 | CALLBACKWAIT
{ $$
= CALLBACKWAIT
; }
456 | CALLEDBACKWAIT
{ $$
= CALLEDBACKWAIT
; }
457 | DIALRETRIES
{ $$
= DIALRETRIES
; }
458 | EARLYHANGUP
{ $$
= EARLYHANGUP
; }
459 | IDLETIME_IN
{ $$
= IDLETIME_IN
; }
460 | IDLETIME_OUT
{ $$
= IDLETIME_OUT
; }
461 | ISDNCONTROLLER
{ $$
= ISDNCONTROLLER
; }
462 | ISDNCHANNEL
{ $$
= ISDNCHANNEL
; }
463 | ISDNTXDELIN
{ $$
= ISDNTXDELIN
; }
464 | ISDNTXDELOUT
{ $$
= ISDNTXDELOUT
; }
465 | RATETYPE
{ $$
= RATETYPE
; }
466 | RECOVERYTIME
{ $$
= RECOVERYTIME
; }
467 | UNITLENGTH
{ $$
= UNITLENGTH
; }
468 | USRDEVICEUNIT
{ $$
= USRDEVICEUNIT
; }
469 | DOWNTIME
{ $$
= DOWNTIME
; }
470 | DOWNTRIES
{ $$
= DOWNTRIES
; }
473 boolkeyword: AUTOUPDOWN
{ $$
= AUTOUPDOWN
; }
474 | BUDGETCALLBACKSFILEROTATE
{ $$
= BUDGETCALLBACKSFILEROTATE
; }
475 | BUDGETCALLOUTSFILEROTATE
{ $$
= BUDGETCALLOUTSFILEROTATE
; }
476 | DIALRANDINCR
{ $$
= DIALRANDINCR
; }
477 | PPP_AUTH_RECHALLENGE
{ $$
= PPP_AUTH_RECHALLENGE
; }
478 | PPP_AUTH_PARANOID
{ $$
= PPP_AUTH_PARANOID
; }
479 | USEDOWN
{ $$
= USEDOWN
; }
482 /* ================== */
483 /* controller section */
484 /* ================== */
486 controllersect: CONTROLLER
493 controllers: controller
{
495 cur_ctrl
= NEXT_CTRL
(cur_ctrl
);
497 cur_ctrl
= get_first_ctrl_state
();
499 | controllers controller
502 controller: strcontroller
507 strcontroller: cstrkeyword
'=' STRING
'\n'
511 | cstrkeyword
'=' NUMBERSTR
'\n'
515 | cfilekeyword
'=' filename
'\n'
521 cstrkeyword: PROTOCOL
{ $$
= PROTOCOL
; }
524 cfilekeyword: FIRMWARE
{ $$
= FIRMWARE
; }