[radvd-devel-l] parser

Andreas Rottmann radvd-devel-l@litech.org
16 Sep 2002 17:38:12 +0200


Gerrit Otte <Gerrit.Otte@ccrle.nec.de> writes:

> Dear everyone,
>=20
> I've added an option (TLV-format) to the advertisements sent by radvd.
> It works if I determine the value hard-coded in the source code. Now I'd
> like radvd to read my option-value from the radvd.conf-file, just as it
> reads e.g. the prefix or HomeAgentInfo from this file.=13
>=20
> In which way do I have to change the parser so that it will be able to
> read the new option value from the radvd.conf?
>=20
>=20
> Maybe anybody can tell me how this bison-parser works? The debugger
> shows that during parsing the file /usr/lib/bison.simple is processed
> (yyparse() is =13invoked), also several functions  or arrayas in
> radvd-0.9.1/lex.yy.c=13 are invoked/read from time to time. And in y.tab.c
> there exists also a function yyparse() in adition to huge arrays which
> are needed by /usr/lib/bison.simple (yytranslate[], yydefact[],
> yytable[],...).=20
>=20
I don't know much about the radvd implementation, but to modify a
bison parser to accept new syntax, there are generally two steps
involved: modify the .y (yacc/bison grammar) file to accept the new
grammar and produce code invoked on the grammar rule that does the
neccessary thing. since radvd doesn't build a syntax tree which is
processed later, this should be quite easy (setting some
variable/struct member of interface struct/whatever).

For more information see 'info bison'.

HTH, Andy
--=20
Andreas Rottmann         | Dru@ICQ        | 118634484@ICQ | a.rottmann@gmx.=
at
http://www.8ung.at/rotty | GnuPG Key: http://www.8ung.at/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B=
62