Commit f90dde08 authored by Pavel Tvrdik's avatar Pavel Tvrdik
Browse files

BIRD daemon notifies the client about new symbol set

BIRD pushes notification to the client about new symbol set and then
the client should request a package with all symbols (`refresh symbols`).
parent 856b1bb1
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -318,12 +318,18 @@ cli_get_symbol_maxlen(void)
}

static void
server_got_symbol(int reply_code, const char *name)
process_internal_message(int reply_code, const char *name)
{
  u32 flag = 0;

  switch (reply_code)
  {
  case RC_NOTIFY:
    if (interactive)
      retrieve_symbols();
    return;

  /* Symbols */
  case RC_CONSTANT_NAME:	flag = CLI_SF_CONSTANT; break;
  case RC_VARIABLE_NAME:	flag = CLI_SF_VARIABLE; break;
  case RC_FILTER_NAME:		flag = CLI_SF_FILTER; break;
@@ -337,6 +343,7 @@ server_got_symbol(int reply_code, const char *name)
    return;
  }

  if (flag && name && *name)
    add_to_symbols(flag, name);
}

@@ -358,7 +365,7 @@ server_got_reply(char *x)
    {
      if (code >= 3000 && code < 4000)
      {
	server_got_symbol(code, x+5);
	process_internal_message(code, x+5);
      }
      else if (code)
      {
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ enum reply_code {
  RC_VARIABLE_NAME = 3006,
  RC_TEMPLATE_NAME = 3007,
  RC_INTERFACE_NAME = 3008,
  RC_NOTIFY = 3009, 		/* Daemon notifies the client about new symbol set */

  RC_REPLY_TOO_LONG = 8000,
  RC_ROUTE_NOT_FOUND = 8001,
+3 −0
Original line number Diff line number Diff line
@@ -448,6 +448,7 @@ config_undo(void)
}

extern void cmd_reconfig_undo_notify(void);
extern void cmd_reconfig_msg(int r);

static void
config_timeout(struct timer *t)
@@ -458,6 +459,8 @@ config_timeout(struct timer *t)
  int r = config_undo();
  if (r < 0)
    log(L_ERR "Undo request failed");

  cmd_reconfig_msg(r);
}

void
+3 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include "nest/locks.h"
#include "conf/conf.h"
#include "filter/filter.h"
#include "client/reply_codes.h"

#include "unix.h"
#include "krt.h"
@@ -269,12 +270,12 @@ cmd_check_config(char *name)
  config_free(conf);
}

static void
void
cmd_reconfig_msg(int r)
{
  switch (r)
    {
    case CONF_DONE:	cli_msg( 3, "Reconfigured"); break;
    case CONF_DONE:	cli_msg( 3, "Reconfigured"); cli_msg(RC_NOTIFY, ""); cli_msg(19, "Nothing to do"); break;
    case CONF_PROGRESS: cli_msg( 4, "Reconfiguration in progress"); break;
    case CONF_QUEUED:	cli_msg( 5, "Reconfiguration already in progress, queueing new config"); break;
    case CONF_UNQUEUED:	cli_msg(17, "Reconfiguration already in progress, removing queued config"); break;