2005-04-28 10:26:44 +02:00
|
|
|
%{
|
|
|
|
/*
|
|
|
|
* $Id: conf.y,v 1.26 2005/04/17 15:20:32 nohar Exp $
|
|
|
|
*
|
|
|
|
* This file is part of the bip proproject
|
|
|
|
* Copyright (C) 2004 Arnaud Cornet
|
2022-01-09 18:25:26 +01:00
|
|
|
* Copyright (C) 2022 Loïc Gomez
|
2005-04-28 10:26:44 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
* See the file "COPYING" for the exact licensing terms.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "util.h"
|
|
|
|
#include "irc.h"
|
|
|
|
#include "tuple.h"
|
|
|
|
extern int yylex (void);
|
|
|
|
extern char *yytext;
|
|
|
|
extern int linec;
|
|
|
|
|
2008-12-10 23:26:37 +01:00
|
|
|
#define YYMALLOC bip_malloc
|
|
|
|
|
2008-12-15 19:19:27 +01:00
|
|
|
extern int yyerror(char *);
|
|
|
|
|
2022-01-09 18:25:26 +01:00
|
|
|
int yywrap(void)
|
2005-04-28 10:26:44 +02:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-12-20 20:26:38 +01:00
|
|
|
//int yydebug = 1;
|
2005-04-28 10:26:44 +02:00
|
|
|
|
|
|
|
list_t *root_list;
|
|
|
|
|
|
|
|
struct tuple *tuple_i_new(int type, int i)
|
|
|
|
{
|
|
|
|
struct tuple *t;
|
2008-12-29 15:31:32 +01:00
|
|
|
t = bip_malloc(sizeof(struct tuple));
|
2005-04-28 10:26:44 +02:00
|
|
|
t->type = type;
|
|
|
|
t->ndata = i;
|
|
|
|
t->tuple_type = TUPLE_INT;
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct tuple *tuple_p_new(int type, void *p)
|
|
|
|
{
|
|
|
|
struct tuple *t;
|
2008-12-29 15:31:32 +01:00
|
|
|
t = bip_malloc(sizeof(struct tuple));
|
2005-04-28 10:26:44 +02:00
|
|
|
t->type = type;
|
|
|
|
t->pdata = p;
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct tuple *tuple_s_new(int type, void *p)
|
|
|
|
{
|
|
|
|
struct tuple *t = tuple_p_new(type, p);
|
|
|
|
t->tuple_type = TUPLE_STR;
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct tuple *tuple_l_new(int type, void *p)
|
|
|
|
{
|
|
|
|
struct tuple *t = tuple_p_new(type, p);
|
|
|
|
t->tuple_type = TUPLE_LIST;
|
|
|
|
return t;
|
|
|
|
}
|
2005-05-26 17:36:15 +02:00
|
|
|
|
2005-04-28 10:26:44 +02:00
|
|
|
%}
|
|
|
|
|
2022-01-02 14:16:10 +01:00
|
|
|
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_SSL_CLIENT_CERTFILE LEX_CIPHERS LEX_CSS_CIPHERS LEX_DEFAULT_CIPHERS LEX_DH_PARAM LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_TIMESTAMP LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_WRITE_OIDENTD LEX_OIDENTD_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_BLRESET_CONNECTION LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY LEX_ADMIN LEX_BIP_USE_NOTICE LEX_CSS_PEM LEX_AUTOJOIN_ON_KICK LEX_IGNORE_CAPAB LEX_RECONN_TIMER LEX_SASL_USERNAME LEX_SASL_PASSWORD LEX_SASL_MECHANISM
|
2005-04-28 10:26:44 +02:00
|
|
|
|
|
|
|
%union {
|
|
|
|
int number;
|
|
|
|
char *string;
|
|
|
|
void *list;
|
|
|
|
struct tuple *tuple;
|
|
|
|
}
|
|
|
|
|
|
|
|
%token <number> LEX_BOOL LEX_INT
|
|
|
|
%token <string> LEX_STRING
|
|
|
|
|
|
|
|
%type <list> commands server network channel user connection
|
|
|
|
%type <tuple> command ser_command net_command cha_command usr_command con_command
|
|
|
|
%%
|
|
|
|
|
|
|
|
commands:
|
|
|
|
{ $$ = root_list = list_new(NULL); }
|
|
|
|
| commands command LEX_SEMICOLON { list_add_last($1, $2); $$ = $1; }
|
|
|
|
;
|
|
|
|
|
|
|
|
command:
|
|
|
|
LEX_LOG_ROOT LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_LOG_ROOT, $3); }
|
|
|
|
| LEX_LOG_FORMAT LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_LOG_FORMAT,
|
|
|
|
$3); }
|
|
|
|
| LEX_LOG_LEVEL LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_LOG_LEVEL, $3); }
|
2014-12-11 17:20:14 +01:00
|
|
|
| LEX_RECONN_TIMER LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_RECONN_TIMER, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_IP LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_IP, $3); }
|
|
|
|
| LEX_PORT LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_PORT, $3); }
|
|
|
|
| LEX_CSS LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_CSS, $3); }
|
2008-02-04 18:38:09 +01:00
|
|
|
| LEX_CSS_PEM LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_CSS_PEM, $3); }
|
2016-04-13 01:04:33 +02:00
|
|
|
| LEX_CSS_CIPHERS LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_CSS_CIPHERS, $3); }
|
|
|
|
| LEX_DEFAULT_CIPHERS LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_DEFAULT_CIPHERS, $3); }
|
2016-07-05 09:18:07 +02:00
|
|
|
| LEX_DH_PARAM LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_DH_PARAM, $3); }
|
2005-05-19 22:55:11 +02:00
|
|
|
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
|
2007-07-01 14:43:09 +02:00
|
|
|
| LEX_LOG_SYSTEM LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG_SYSTEM, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new(
|
2007-09-02 14:59:19 +02:00
|
|
|
LEX_LOG_SYNC_INTERVAL, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_PID_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PID_FILE, $3); }
|
2018-11-18 21:07:16 +01:00
|
|
|
| LEX_WRITE_OIDENTD LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_WRITE_OIDENTD, $3); }
|
2016-06-29 19:55:27 +02:00
|
|
|
| LEX_OIDENTD_FILE LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_OIDENTD_FILE, $3); }
|
2007-11-11 07:37:19 +01:00
|
|
|
/* deprecated */
|
|
|
|
| LEX_BACKLOG_LINES LEX_EQ LEX_INT {
|
|
|
|
$$ = tuple_i_new(LEX_BACKLOG_LINES, $3);
|
|
|
|
}
|
2021-10-07 16:16:02 +02:00
|
|
|
| LEX_BACKLOG_TIMESTAMP LEX_EQ LEX_STRING {
|
|
|
|
$$ = tuple_s_new(LEX_BACKLOG_TIMESTAMP, $3);
|
|
|
|
}
|
2007-11-11 07:37:19 +01:00
|
|
|
| LEX_BACKLOG_NO_TIMESTAMP LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_BACKLOG_NO_TIMESTAMP, $3);
|
|
|
|
}
|
|
|
|
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); }
|
|
|
|
| LEX_BLRESET_ON_TALK LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_BLRESET_ON_TALK, $3);
|
|
|
|
}
|
|
|
|
| LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $3);
|
|
|
|
}
|
|
|
|
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
|
|
|
LEX_ALWAYS_BACKLOG, $3); }
|
|
|
|
/* /deprecated */
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_NETWORK LEX_LBRA network LEX_RBRA { $$ = tuple_l_new(LEX_NETWORK,
|
2007-09-02 14:59:19 +02:00
|
|
|
$3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_USER LEX_LBRA user LEX_RBRA { $$ = tuple_l_new(LEX_USER, $3); }
|
|
|
|
|
|
|
|
network:
|
|
|
|
{ $$ = list_new(NULL); }
|
|
|
|
| network net_command LEX_SEMICOLON { list_add_last($1, $2); $$ = $1; }
|
|
|
|
|
|
|
|
net_command:
|
|
|
|
LEX_NAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NAME, $3); }
|
|
|
|
| LEX_SSL LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_SSL, $3); }
|
2016-04-13 01:04:33 +02:00
|
|
|
| LEX_CIPHERS LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_CIPHERS, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_SERVER LEX_LBRA server LEX_RBRA {
|
2007-09-02 14:59:19 +02:00
|
|
|
$$ = tuple_l_new(LEX_SERVER, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
|
|
|
|
user:
|
|
|
|
{ $$ = list_new(NULL); }
|
|
|
|
| user usr_command LEX_SEMICOLON { list_add_last($1, $2); $$ = $1; }
|
|
|
|
|
|
|
|
usr_command:
|
|
|
|
LEX_NAME LEX_EQ LEX_STRING {
|
|
|
|
$$ = tuple_s_new(LEX_NAME, $3); }
|
|
|
|
| LEX_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PASSWORD,
|
2007-09-02 14:59:19 +02:00
|
|
|
$3); }
|
2007-09-26 14:45:30 +02:00
|
|
|
| LEX_ADMIN LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_ADMIN, $3); }
|
2007-09-28 13:20:32 +02:00
|
|
|
| LEX_BIP_USE_NOTICE LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_BIP_USE_NOTICE, $3); }
|
2005-06-04 13:05:54 +02:00
|
|
|
| LEX_SSL_CHECK_MODE LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
2007-09-02 14:59:19 +02:00
|
|
|
LEX_SSL_CHECK_MODE, $3); }
|
2005-06-04 13:05:54 +02:00
|
|
|
| LEX_SSL_CHECK_STORE LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
2007-09-02 14:59:19 +02:00
|
|
|
LEX_SSL_CHECK_STORE, $3); }
|
2008-01-20 18:49:44 +01:00
|
|
|
| LEX_SSL_CLIENT_CERTFILE LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
|
|
|
LEX_SSL_CLIENT_CERTFILE, $3); }
|
2005-07-09 14:55:01 +02:00
|
|
|
| LEX_DEFAULT_USER LEX_EQ LEX_STRING {
|
|
|
|
$$ = tuple_s_new(LEX_DEFAULT_USER, $3); }
|
|
|
|
| LEX_DEFAULT_NICK LEX_EQ LEX_STRING {
|
|
|
|
$$ = tuple_s_new(LEX_DEFAULT_NICK, $3); }
|
|
|
|
| LEX_DEFAULT_REALNAME LEX_EQ LEX_STRING {
|
|
|
|
$$ = tuple_s_new(LEX_DEFAULT_REALNAME, $3); }
|
2007-09-02 14:59:19 +02:00
|
|
|
| LEX_BACKLOG_LINES LEX_EQ LEX_INT {
|
|
|
|
$$ = tuple_i_new(LEX_BACKLOG_LINES, $3);
|
|
|
|
}
|
2021-10-07 16:16:02 +02:00
|
|
|
| LEX_BACKLOG_TIMESTAMP LEX_EQ LEX_STRING {
|
|
|
|
$$ = tuple_s_new(LEX_BACKLOG_TIMESTAMP, $3);
|
|
|
|
}
|
2007-09-02 14:59:19 +02:00
|
|
|
| LEX_BACKLOG_NO_TIMESTAMP LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_BACKLOG_NO_TIMESTAMP, $3);
|
|
|
|
}
|
|
|
|
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); }
|
|
|
|
| LEX_BLRESET_ON_TALK LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_BLRESET_ON_TALK, $3);
|
|
|
|
}
|
2009-01-17 12:50:39 +01:00
|
|
|
| LEX_BLRESET_CONNECTION LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_BLRESET_CONNECTION, $3);
|
|
|
|
}
|
2007-09-02 14:59:19 +02:00
|
|
|
| LEX_BL_MSG_ONLY LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $3);
|
|
|
|
}
|
|
|
|
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
|
|
|
LEX_ALWAYS_BACKLOG, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_CONNECTION LEX_LBRA connection LEX_RBRA {
|
2007-09-02 14:59:19 +02:00
|
|
|
$$ = tuple_l_new(LEX_CONNECTION, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
|
|
|
|
connection:
|
|
|
|
{ $$ = list_new(NULL); }
|
|
|
|
| connection con_command LEX_SEMICOLON {
|
|
|
|
list_add_last($1, $2); $$ = $1; }
|
|
|
|
|
|
|
|
con_command:
|
|
|
|
LEX_NAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NAME, $3); }
|
|
|
|
| LEX_NETWORK LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NETWORK,
|
2007-09-02 14:59:19 +02:00
|
|
|
$3); }
|
2011-04-05 23:43:05 +02:00
|
|
|
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_NICK LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NICK, $3); }
|
|
|
|
| LEX_USER LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_USER, $3); }
|
|
|
|
| LEX_REALNAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_REALNAME,
|
2007-09-02 14:59:19 +02:00
|
|
|
$3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_PASSWORD,
|
2007-09-02 14:59:19 +02:00
|
|
|
$3); }
|
2022-01-02 14:16:10 +01:00
|
|
|
| LEX_SASL_USERNAME LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
|
|
|
LEX_SASL_USERNAME, $3); }
|
|
|
|
| LEX_SASL_PASSWORD LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
|
|
|
LEX_SASL_PASSWORD, $3); }
|
|
|
|
| LEX_SASL_MECHANISM LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
|
|
|
LEX_SASL_MECHANISM, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_VHOST LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_VHOST, $3); }
|
|
|
|
| LEX_SOURCE_PORT LEX_EQ LEX_INT {
|
|
|
|
$$ = tuple_i_new(LEX_SOURCE_PORT, $3); }
|
|
|
|
| LEX_AWAY_NICK LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_AWAY_NICK,
|
2007-09-02 14:59:19 +02:00
|
|
|
$3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_FOLLOW_NICK LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_FOLLOW_NICK, $3); }
|
|
|
|
| LEX_IGN_FIRST_NICK LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
|
|
|
LEX_IGN_FIRST_NICK, $3); }
|
2009-01-21 17:24:54 +01:00
|
|
|
| LEX_AUTOJOIN_ON_KICK LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_AUTOJOIN_ON_KICK, $3); }
|
2009-02-08 12:36:49 +01:00
|
|
|
| LEX_IGNORE_CAPAB LEX_EQ LEX_BOOL {
|
|
|
|
$$ = tuple_i_new(LEX_IGNORE_CAPAB, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_CHANNEL LEX_LBRA channel LEX_RBRA { $$ = tuple_l_new(
|
2009-01-21 17:24:54 +01:00
|
|
|
LEX_CHANNEL, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
| LEX_ON_CONNECT_SEND LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
2009-01-21 17:24:54 +01:00
|
|
|
LEX_ON_CONNECT_SEND, $3); }
|
2006-09-25 14:08:31 +02:00
|
|
|
| LEX_NO_CLIENT_AWAY_MSG LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
2009-01-21 17:24:54 +01:00
|
|
|
LEX_NO_CLIENT_AWAY_MSG, $3); }
|
2007-09-26 22:18:50 +02:00
|
|
|
| LEX_SSL_CHECK_MODE LEX_EQ LEX_STRING { $$ = tuple_s_new(
|
|
|
|
LEX_SSL_CHECK_MODE, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
channel:
|
|
|
|
{ $$ = list_new(NULL); }
|
|
|
|
| channel cha_command LEX_SEMICOLON { list_add_last($1, $2); $$ = $1; }
|
|
|
|
|
|
|
|
cha_command:
|
|
|
|
LEX_NAME LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_NAME, $3); }
|
|
|
|
| LEX_KEY LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_KEY, $3); }
|
2007-09-27 01:08:10 +02:00
|
|
|
| LEX_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_BACKLOG, $3); }
|
2005-04-28 10:26:44 +02:00
|
|
|
|
|
|
|
server:
|
|
|
|
{ $$ = list_new(NULL); }
|
|
|
|
| server ser_command LEX_SEMICOLON { list_add_last($1, $2); $$ = $1; }
|
|
|
|
|
|
|
|
ser_command:
|
|
|
|
LEX_HOST LEX_EQ LEX_STRING { $$ = tuple_s_new(LEX_HOST, $3); }
|
|
|
|
| LEX_PORT LEX_EQ LEX_INT { $$ = tuple_i_new(LEX_PORT, $3); }
|