Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syslog compatible server type #329

Merged
merged 4 commits into from
May 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conffile.l
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ cluster {
<idcl>tcp return crTCP;
<idcl>type return crTYPE;
<idcl>linemode return crLINEMODE;
<idcl>syslog return crSYSLOGMODE;
<idcl>transport return crTRANSPORT;
<idcl>gzip return crGZIP;
<idcl>lz4 return crLZ4;
Expand Down
868 changes: 447 additions & 421 deletions conffile.tab.c

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions conffile.tab.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
extern int router_yydebug;
#endif
/* "%code requires" blocks. */
#line 11 "conffile.y" /* yacc.c:1909 */
#line 11 "conffile.y" /* yacc.c:1915 */

struct _clust {
enum clusttype t;
Expand All @@ -59,6 +59,7 @@ struct _clhost {
int port;
char *inst;
int proto;
con_type type;
con_trnsp trnsp;
void *saddr;
void *hint;
Expand Down Expand Up @@ -92,7 +93,7 @@ struct _rcptr_trsp {
char *pemcert;
};

#line 96 "conffile.tab.h" /* yacc.c:1909 */
#line 97 "conffile.tab.h" /* yacc.c:1915 */

/* Token type. */
#ifndef ROUTER_YYTOKENTYPE
Expand Down Expand Up @@ -159,16 +160,17 @@ struct _rcptr_trsp {
crLISTEN = 315,
crTYPE = 316,
crLINEMODE = 317,
crTRANSPORT = 318,
crGZIP = 319,
crLZ4 = 320,
crSSL = 321,
crUNIX = 322,
crINCLUDE = 323,
crCOMMENT = 324,
crSTRING = 325,
crUNEXPECTED = 326,
crINTVAL = 327
crSYSLOGMODE = 318,
crTRANSPORT = 319,
crGZIP = 320,
crLZ4 = 321,
crSSL = 322,
crUNIX = 323,
crINCLUDE = 324,
crCOMMENT = 325,
crSTRING = 326,
crUNEXPECTED = 327,
crINTVAL = 328
};
#endif

Expand Down Expand Up @@ -200,6 +202,8 @@ union ROUTER_YYSTYPE
con_proto rcptr_proto;
/* cluster_opt_transport */
con_trnsp cluster_opt_transport;
/* cluster_opt_type */
con_type cluster_opt_type;
/* match_opt_send_to */
destinations * match_opt_send_to;
/* match_send_to */
Expand Down Expand Up @@ -280,7 +284,7 @@ union ROUTER_YYSTYPE
struct _rcptr * receptor;
/* transport_mode */
struct _rcptr_trsp * transport_mode;
#line 284 "conffile.tab.h" /* yacc.c:1909 */
#line 288 "conffile.tab.h" /* yacc.c:1915 */
};

typedef union ROUTER_YYSTYPE ROUTER_YYSTYPE;
Expand Down
12 changes: 8 additions & 4 deletions conffile.y
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct _clhost {
int port;
char *inst;
int proto;
con_type type;
con_trnsp trnsp;
void *saddr;
void *hint;
Expand Down Expand Up @@ -66,6 +67,7 @@ struct _rcptr_trsp {
%type <struct _clust> cluster_type cluster_file
%type <int> cluster_opt_repl cluster_opt_useall
%type <con_proto> cluster_opt_proto
%type <con_type> cluster_opt_type
%type <char *> cluster_opt_instance
%type <cluster *> cluster
%type <struct _clhost *> cluster_host cluster_hosts cluster_opt_host
Expand Down Expand Up @@ -104,7 +106,7 @@ struct _rcptr_trsp {
%type <char *> statistics_opt_prefix

%token crLISTEN
%token crTYPE crLINEMODE crTRANSPORT crGZIP crLZ4 crSSL crUNIX
%token crTYPE crLINEMODE crSYSLOGMODE crTRANSPORT crGZIP crLZ4 crSSL crUNIX
%type <con_proto> rcptr_proto
%type <struct _rcptr *> receptor opt_receptor receptors
%type <struct _rcptr_trsp *> transport_mode
Expand Down Expand Up @@ -191,7 +193,7 @@ cluster: crCLUSTER crSTRING[name] cluster_type[type] cluster_hosts[servers]

for (w = $servers; w != NULL; w = w->next) {
err = router_add_server(rtr, w->ip, w->port, w->inst,
T_LINEMODE, w->trnsp, w->proto,
w->type, w->trnsp, w->proto,
w->saddr, w->hint, $type.ival, $$);
if (err != NULL) {
router_yyerror(&yylloc, yyscanner, rtr, ralloc, palloc, err);
Expand Down Expand Up @@ -320,6 +322,7 @@ cluster_host: crSTRING[ip] cluster_opt_instance[inst]
}
ret->inst = $inst;
ret->proto = $prot;
ret->type = $type;
ret->trnsp = $trnsp;
ret->next = NULL;
$$ = ret;
Expand All @@ -342,8 +345,9 @@ cluster_opt_proto: { $$ = CON_TCP; }
| crPROTO crTCP { $$ = CON_TCP; }
;

cluster_opt_type:
| crTYPE crLINEMODE
cluster_opt_type: { $$ = T_LINEMODE; }
| crTYPE crLINEMODE { $$ = T_LINEMODE; }
| crTYPE crSYSLOGMODE { $$ = T_SYSLOGMODE; }
;

cluster_opt_transport: { $$ = W_PLAIN; }
Expand Down
Loading