Commit graph

38 commits

Author SHA1 Message Date
Martin Mares
58f7d004fd Fixes to the progdoc. 2000-06-07 13:25:53 +00:00
Martin Mares
2e9b24211a Spelling fixes to progdoc. 2000-06-07 12:29:08 +00:00
Martin Mares
04dc62a011 Nested scopes could never have worked. My fault I wrote such a buggy code,
Pavel's fault that he's never tested shadowing of declarations in the filters.

cf_define_symbol() has been modified to check the scope of the symbol it's
given and it if it's an already defined symbol, but in a different scope,
a copy is created in the current scope and redefined to the new meaning,
the consequence being that it cf_define_symbol() now returns the new symbol
you need to use when assigning aux and aux2.
2000-06-04 19:30:13 +00:00
Martin Mares
58f9453776 Moved parser docs to cf-lex.l, so that the parser compiles. 2000-06-04 15:22:20 +00:00
Martin Mares
06607335ef Documentation. 2000-06-03 18:23:00 +00:00
Martin Mares
c0b2f6463f cf_symbol_class_name now recognizes SYM_IPA. 2000-06-03 16:56:00 +00:00
Pavel Machek
5f4aee76a2 Added && and ||. 2000-06-01 08:43:29 +00:00
Martin Mares
69a20d2eff Recognize `!'. 2000-05-30 21:46:21 +00:00
Pavel Machek
9a09a64bb4 Use ? in path matching to avoid /* trap. 2000-05-25 14:58:38 +00:00
Martin Mares
a412f01ea8 Include CF_HDR section in keywords.h as well, so that protocol symbols
can be used in definition of ENUM's.
2000-04-28 15:12:03 +00:00
Martin Mares
221135d6bf Include "lib/string.h" instead of <string.h>. It should give us bzero()
and other non-portable functions on all systems.
2000-03-31 23:30:21 +00:00
Pavel Machek
c8d5ffafb7 Fix <=, >=, != 2000-03-10 20:21:12 +00:00
Martin Mares
4b87e256eb Split off general commands to cmds.c.
Added `show symbols' command which dumps whole symbol table together
with symbol types etc.
2000-01-19 12:30:19 +00:00
Martin Mares
d272fe22dd Separated `official protocol names' used in status dumps from name templates
used for automatic generation of instance names.

	protocol->name is the official name
	protocol->template is the name template (usually "name%d"),
		should be all lowercase.

Updated all protocols to define the templates, checked that their configuration
grammar includes proto_name which generates the name and interns it in the
symbol table.
2000-01-17 11:52:50 +00:00
Martin Mares
ca0edc5395 When a quoted string is encountered, don't forget to copy it to the
config pool before passing it to the parser.
2000-01-16 23:36:53 +00:00
Martin Mares
efe51e3863 Avoid `default rule can be matched' warning in CLI state. 1999-12-02 12:04:39 +00:00
Martin Mares
c9aae7f47f Lexer supports fallback symbol tables and uses them to recognize
symbols from global config when parsing CLI commands.

cf_lex_init_tables() is now called automatically inside the lexer.
1999-11-30 14:03:36 +00:00
Martin Mares
944f008af7 Defined CF_ENUM. 1999-11-15 11:35:41 +00:00
Martin Mares
c8f61a01ea Symbols are not scoped. 1999-11-04 13:51:52 +00:00
Pavel Machek
e5005be2b4 You should not follow next two times. 1999-11-03 22:21:26 +00:00
Martin Mares
bc2fb68098 Parse CLI commands. We use the same parser as for configuration files (because
we want to allow filter and similar complex constructs to be used in commands
and we should avoid code duplication), only with CLI_MARKER token prepended
before the whole input.

Defined macro CF_CLI(cmd, args, help) for defining CLI commands in .Y files.
The first argument specifies the command itself, the remaining two arguments
are copied to the help file (er, will be copied after the help file starts
to exist). This macro automatically creates a skeleton rule for the command,
you only need to append arguments as in:

	CF_CLI(STEAL MONEY, <$>, [[Steal <$> US dollars or equivalent in any other currency]]): NUM {
		cli_msg(0, "%d$ stolen", $3);
	} ;

Also don't forget to reset lexer state between inputs.
1999-10-31 17:47:47 +00:00
Martin Mares
dce267832a Basic support for IPv6. The system-dependent part doesn't work yet,
but the core routines are there and seem to be working.

   o  lib/ipv6.[ch] written
   o  Lexical analyser recognizes IPv6 addresses and when in IPv6
      mode, treats pure IPv4 addresses as router IDs.
   o  Router ID must be configured manually on IPv6 systems.
   o  Added SCOPE_ORGANIZATION for org-scoped IPv6 multicasts.
   o  Fixed few places where ipa_(hton|ntoh) was called as a function
      returning converted address.
1999-08-03 19:36:06 +00:00
Martin Mares
4107df1d1b Implemented two new symbol handling functions:
o  cf_define_symbol() -- it assigns a meaning to a symbol, bailing
     out if it already has one.
  o  cf_find_symbol() -- finds symbol by name and creates it if not found.

Also modified filter/config.Y to make use of the first function.
1999-05-17 20:06:19 +00:00
Pavel Machek
38506f71b0 Sets of integers now actually work. Sets of IP will work as soon as
compare function is ready.
1999-04-12 19:58:18 +00:00
Pavel Machek
23b1539bf9 Filters upgraded - a bit. Moved code to filter.c because it is where
it belongs. (f-util.c stays there for auxiliary and non-important things.)
1999-04-07 12:11:08 +00:00
Martin Mares
7f400d1c62 After today's lengthy discussions about filter syntax, let's clean up
whitespace/semicolon rules for whole config file:

   o  All non-zero amounts of whitespace are equivalent to single space
      (aka `all the whitespace has been born equal' ;-)).
   o  Comments count as whitespace.
   o  Whitespace has no syntactic signifance (it can only separate lexical
      elements).
   o  Consequence: line ends are no longer treated as `;'s.
   o  Every declaration must be terminated by an explicit `;' unless
      or by a group enclosed in `{' and `}'.
1999-03-29 19:04:14 +00:00
Martin Mares
4ba84ebc82 Slightly better generator of default protocol instance names. 1999-03-26 21:37:29 +00:00
Martin Mares
726141746b '#' comments in config files are equivalent to end of line, therefore
also to implicit ';'.
1999-02-13 21:34:33 +00:00
Martin Mares
31b3e1bbf5 Implemented new configuration/reconfiguration interface and defined protocol
state machines. Full explanation will follow soon.
1999-02-05 21:37:34 +00:00
Pavel Machek
489b6b5e00 #if 1 that creeped into cvs killed. 1999-01-15 16:13:51 +00:00
Pavel Machek
72380a3447 Filters added. They are unable to do anything interesting for now
(with exception of printing integers to screen), but they exist.
1999-01-15 14:41:51 +00:00
Martin Mares
49e7e5ee0b New makefiles. Includes support for out-of-source-tree builds. 1999-01-10 00:18:32 +00:00
Martin Mares
cc12cf05c7 cf_error() now accepts any format strings instead of just an error
message. Also added extra kludge to get rid of collisions of REJECT
symbols.
1998-12-06 23:10:28 +00:00
Martin Mares
b35d72ac66 Name cleanups as suggested by Pavel:
- cfg_strcpy() -> cfg_strdup()
- mempool -> linpool, mp_* -> lp_*  [to avoid confusion with memblock, mb_*]

Anyway, it might be better to stop ranting about names and do some *real* work.
1998-12-06 11:59:18 +00:00
Martin Mares
49e4a4d1fd Created new functions for allocating configuration data:
o  cfg_alloc(size) -- generic memory allocation
   o  cfg_allocu(size) -- unaligned memory allocation
   o  cfg_allocz(size) -- zeroed memory allocation
   o  cfg_strcpy(str) -- allocate a copy of a string

Also fixed a bug in lexing of string literals.
1998-11-29 21:59:37 +00:00
Martin Mares
0b62c3a7c7 Trivial 15-line bison excercise: Implemented expressions including
user-defined numeric symbols. Whenever possible, use `expr' instead
of `NUM' to get full express ion power :-)
1998-11-27 21:32:45 +00:00
Martin Mares
8450be97d6 Added generator of default names. 1998-11-27 21:07:02 +00:00
Martin Mares
82fc7be7bb Lexical analyser. 1998-11-27 19:35:50 +00:00