Commit graph

178 commits

Author SHA1 Message Date
Martin Mares
fae0396ea4 Completion works. Unfortunately, we have to access a couple of internal
symbols of libreadline :-(
2000-02-17 23:37:16 +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
f5ad9f87a3 Killed a couple of bugs in the neighbor cache.
Manual disable/enable/restart/shutdown/reconfiguration of protocols
no longer hangs on loops in neighbor lists :)
2000-01-19 11:52:32 +00:00
Martin Mares
3ea1ba632b Killed protocol->priority. Protocol startup should be clean and hack-free now.
It seems everything still works (except for disable/enable/restart which hangs
sometimes, but it's another story).
2000-01-18 11:01:03 +00:00
Martin Mares
54aaa89ada protocol->startup_counter no longer exists. 2000-01-18 10:42:45 +00:00
Martin Mares
471cc0be65 Moved initlialization of protocol lists to global init. Argh. 2000-01-17 12:38:07 +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
88dc89f991 Device protocol supports reconfiguration. 2000-01-17 00:20:17 +00:00
Martin Mares
26368f656c Don't forget changing proto->name to point to name in new configuration
(to avoid the name being freed with the old config).

Also remember to add proto_pipe to protocol_list.
2000-01-17 00:19:58 +00:00
Martin Mares
f14a4becbe Reworked proto lists -- each proto is now in two lists: the global one
(proto_list) and per-type one (original lists). A lot of things simplified.

Implemented `disable', `enable' and `restart' CLI commands.
2000-01-16 23:30:06 +00:00
Martin Mares
30a6108ccc Added filter_same() for comparision of two filters.
Pavel, please implement this as soon as possible.
2000-01-16 17:49:32 +00:00
Martin Mares
bf8558bc9c Converted shutdown to a kind of reconfiguration, it's no more handled
as a exception in protocol state machines. Introduced a `shutdown'
CLI command. Killed few reconfiguration bugs.
2000-01-16 17:40:26 +00:00
Martin Mares
50fe90edf3 First attempt on dynamic reconfiguration. There are still lots of bugs
and problems to solve, but the hardest part works.
2000-01-16 16:44:50 +00:00
Martin Mares
394aec8fdd Don't forget to set proto->min_scope = SCOPE_HOST. 2000-01-16 16:40:57 +00:00
Martin Mares
476e108425 Minor cleanups. 1999-12-16 13:51:43 +00:00
Martin Mares
ccdc339756 Avoid touching F_MODIFY, it no longer exists. 1999-12-16 12:59:09 +00:00
Martin Mares
f545d38707 Added universal locking mechanism which will solve problems
with protocols wanting to use the same port on the same interface
during reconfiguration time.

How to use locks: In the if_notify hook, just order locks for the
interfaces you want to work with and do the real socket opening after the
lock hook function gets called. When you stop using the socket, close
it and rfree() the lock.

Please update your protocols to use the new locking mechanism.
1999-12-09 18:54:20 +00:00
Martin Mares
0da472d7e8 Except for special protocols (nowadays only the kernel syncer), don't
export host and link scope routes.
1999-12-08 14:16:13 +00:00
Martin Mares
7c0cc76ed7 Moved initialization of protocol list to proto.c.
Added sysdep configuration hooks.
1999-12-06 13:44:45 +00:00
Martin Mares
34350a5270 Implemented echoing of log messages to CLI connections. Just try `echo all'. 1999-12-06 12:34:45 +00:00
Martin Mares
f3792601df Don't forget to send an OK reply after dumping debug information. 1999-12-04 23:28:56 +00:00
Martin Mares
305a01f57b Added DEBUG commands.
Removed CLI tests, real commands now serve as much better examples.
1999-12-04 23:17:29 +00:00
Martin Mares
02c1fbddd4 Added proto_get_named() to be used in CLI commands to get protocol instance
of a given protocol with optionally given name. See `show static' for an
example.
1999-12-03 11:40:45 +00:00
Martin Mares
28e01f85c6 Renamed SHOW PROTOCOLS VERBOSE to SHOW PROTOCOLS ALL to be consistent
with the other commands.
1999-12-03 11:10:50 +00:00
Martin Mares
430da60fa2 Implemented `show route where <condition>' command.
Pavel, please check my addition to filter/config.Y.
1999-12-02 14:04:44 +00:00
Martin Mares
730f2e2c8c Added dumping of routing tables (`show route'). This includes filtering. 1999-12-01 15:10:21 +00:00
Martin Mares
04a60c689a Added get_route_info and show_route_data hooks to struct protocol.
Please implement them.
1999-12-01 15:08:32 +00:00
Martin Mares
f611f0ee82 Reset temporary parser data before parsing, not afterwards. This enables
deferred CLI command handlers to store their temporary data in the CLI
parsing pool.
1999-12-01 15:07:56 +00:00
Martin Mares
9685deb910 `show protocols' now shows time of last state change and protocol-dependent
status information (obtained via newly introduced hook protocol->get_status).
1999-12-01 12:00:15 +00:00
Martin Mares
5954dcfab7 Introduced new protocol-dependent integer field `aux' to struct neighbor. 1999-12-01 11:59:24 +00:00
Martin Mares
1d2664a4d4 Remember protocol instance in proto_config and use that for
`show protocols <name>'.
1999-11-30 14:04:09 +00:00
Martin Mares
f0474f2070 Use TIME_INFINITY for initialization of password entries instead
of 2000000000 (BTW who wrote that???)
1999-11-30 14:02:27 +00:00
Martin Mares
0d3e6bceee show interfaces' and show protocols' works. 1999-11-30 12:57:14 +00:00
Martin Mares
10b5baaef3 Don't use continuation shortcuts until real client is written. 1999-11-30 12:56:52 +00:00
Martin Mares
ae97b946e9 Added few basic commands: show status, show interfaces [summary],
show protocols (incomplete).
1999-11-25 15:35:30 +00:00
Martin Mares
3579376927 cli_msg() moved to cli.h, so that it can be used outside the parser. 1999-11-25 15:34:51 +00:00
Pavel Machek
774f149959 Fix timeouts. Triggered updates are not done, yet. 1999-11-25 12:01:45 +00:00
Martin Mares
8d24b6899d Allow EA type to be set to 'undefined' which overrides all further definitons
of that EA in the same list and causes ea_find() to fail unless you add
EA_ALLOW_UNDEF to the second argument.

ea_sort (resp. ea_do_prune()) removes all undef'd attributes from the list.

I hope this works :)
1999-11-18 14:41:29 +00:00
Martin Mares
da40b6f753 DEF_PREF_UKR and DEF_PREF_SINK removed. 1999-11-18 13:42:51 +00:00
Martin Mares
62a4639548 Added some temporary examples of how to define CLI commands (search for CF_CLI).
To define a new command, just add a new rule to the gramar:
  CF_CLI(COMMAND NAME, arguments, help-args, help-text) {
	what-should-the-command-do
	} ;
where <arguments> are appended to the RHS of the rule, <help-args> is the
argument list as shown in the help and <help-text> is description of the
command for the help.

<what-should-the-command-do> is a C code snippet to be executed. It should
not take too much time to execute. If you want to print out a lot of
information, you can schedule a routine to be called after the current
buffer is flushed by making cli->cont point to the routine (see the
TEST LONG command definition for an example); if the connection is closed
in the meantime, cli->cleanup gets called.

You can access `struct cli' belonging to the connection you're currently
servicing as this_cli, but only during parse time, not from routines scheduled
for deferred execution.

Functions to call inside command handlers:
  cli_printf(cli, code, printf-args) -- print text to CLI connection,
	<code> is message code as assigned in doc/reply_codes or a negative
	one if it's a continuation line.
  cli_msg(code, printf-args) -- the same for this_cli.

Use 'sock -x bird.ctl' for connecting to the CLI until a client is written.
1999-11-17 12:14:44 +00:00
Martin Mares
ffb59d243a Command line interface now works. 1999-11-17 12:00:21 +00:00
Martin Mares
7d509304b5 An example of how to define enums. 1999-11-15 11:36:22 +00:00
Martin Mares
2727bb7c5b Renamed attr->attrs to attr->eattrs. 1999-11-04 13:29:43 +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
b9672a845f The CLI I/O functions work as desired. 1999-10-31 15:43:44 +00:00
Martin Mares
7d3aab1c16 First steps of the Command Line Interface: I/O routines. 1999-10-29 12:10:10 +00:00
Martin Mares
0d70292d88 Events now return a value. If it's non-zero, the event is re-queued
for processing in next event cycle. This can be used to prevent background
actions (hint: user commands) from hogging the CPU for too long time.
1999-10-29 12:08:49 +00:00
Pavel Machek
ac40c888c2 Obvious bugs in authentication fixed. 1999-10-02 10:44:48 +00:00
Martin Mares
d7975d261f Ouch, how could I write this? 1999-08-03 19:38:48 +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