mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 17:51:53 +00:00
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`).
This commit is contained in:
parent
856b1bb1ef
commit
f90dde08f3
@ -318,12 +318,18 @@ cli_get_symbol_maxlen(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
server_got_symbol(int reply_code, const char *name)
|
process_internal_message(int reply_code, const char *name)
|
||||||
{
|
{
|
||||||
u32 flag = 0;
|
u32 flag = 0;
|
||||||
|
|
||||||
switch (reply_code)
|
switch (reply_code)
|
||||||
{
|
{
|
||||||
|
case RC_NOTIFY:
|
||||||
|
if (interactive)
|
||||||
|
retrieve_symbols();
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Symbols */
|
||||||
case RC_CONSTANT_NAME: flag = CLI_SF_CONSTANT; break;
|
case RC_CONSTANT_NAME: flag = CLI_SF_CONSTANT; break;
|
||||||
case RC_VARIABLE_NAME: flag = CLI_SF_VARIABLE; break;
|
case RC_VARIABLE_NAME: flag = CLI_SF_VARIABLE; break;
|
||||||
case RC_FILTER_NAME: flag = CLI_SF_FILTER; break;
|
case RC_FILTER_NAME: flag = CLI_SF_FILTER; break;
|
||||||
@ -337,7 +343,8 @@ server_got_symbol(int reply_code, const char *name)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_to_symbols(flag, name);
|
if (flag && name && *name)
|
||||||
|
add_to_symbols(flag, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PRINTF(LEN, PARGS...) do { if (!skip_input) len = printf(PARGS); } while(0)
|
#define PRINTF(LEN, PARGS...) do { if (!skip_input) len = printf(PARGS); } while(0)
|
||||||
@ -358,7 +365,7 @@ server_got_reply(char *x)
|
|||||||
{
|
{
|
||||||
if (code >= 3000 && code < 4000)
|
if (code >= 3000 && code < 4000)
|
||||||
{
|
{
|
||||||
server_got_symbol(code, x+5);
|
process_internal_message(code, x+5);
|
||||||
}
|
}
|
||||||
else if (code)
|
else if (code)
|
||||||
{
|
{
|
||||||
|
@ -81,6 +81,7 @@ enum reply_code {
|
|||||||
RC_VARIABLE_NAME = 3006,
|
RC_VARIABLE_NAME = 3006,
|
||||||
RC_TEMPLATE_NAME = 3007,
|
RC_TEMPLATE_NAME = 3007,
|
||||||
RC_INTERFACE_NAME = 3008,
|
RC_INTERFACE_NAME = 3008,
|
||||||
|
RC_NOTIFY = 3009, /* Daemon notifies the client about new symbol set */
|
||||||
|
|
||||||
RC_REPLY_TOO_LONG = 8000,
|
RC_REPLY_TOO_LONG = 8000,
|
||||||
RC_ROUTE_NOT_FOUND = 8001,
|
RC_ROUTE_NOT_FOUND = 8001,
|
||||||
|
@ -448,6 +448,7 @@ config_undo(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern void cmd_reconfig_undo_notify(void);
|
extern void cmd_reconfig_undo_notify(void);
|
||||||
|
extern void cmd_reconfig_msg(int r);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
config_timeout(struct timer *t)
|
config_timeout(struct timer *t)
|
||||||
@ -458,6 +459,8 @@ config_timeout(struct timer *t)
|
|||||||
int r = config_undo();
|
int r = config_undo();
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
log(L_ERR "Undo request failed");
|
log(L_ERR "Undo request failed");
|
||||||
|
|
||||||
|
cmd_reconfig_msg(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "nest/locks.h"
|
#include "nest/locks.h"
|
||||||
#include "conf/conf.h"
|
#include "conf/conf.h"
|
||||||
#include "filter/filter.h"
|
#include "filter/filter.h"
|
||||||
|
#include "client/reply_codes.h"
|
||||||
|
|
||||||
#include "unix.h"
|
#include "unix.h"
|
||||||
#include "krt.h"
|
#include "krt.h"
|
||||||
@ -269,12 +270,12 @@ cmd_check_config(char *name)
|
|||||||
config_free(conf);
|
config_free(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
cmd_reconfig_msg(int r)
|
cmd_reconfig_msg(int r)
|
||||||
{
|
{
|
||||||
switch (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_PROGRESS: cli_msg( 4, "Reconfiguration in progress"); break;
|
||||||
case CONF_QUEUED: cli_msg( 5, "Reconfiguration already in progress, queueing new config"); 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;
|
case CONF_UNQUEUED: cli_msg(17, "Reconfiguration already in progress, removing queued config"); break;
|
||||||
|
Loading…
Reference in New Issue
Block a user