0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-24 10:41:54 +00:00

Client: explicit end of symbol dump

This commit is contained in:
Jan Moskyto Matejka 2017-07-12 12:43:32 +02:00
parent b5e9fe3e55
commit b12daceb57
3 changed files with 12 additions and 9 deletions

View File

@ -366,6 +366,7 @@ process_internal_message(int reply_code, const char *name)
welcomed = 1; welcomed = 1;
printf("BIRD %s ready.\n", name); printf("BIRD %s ready.\n", name);
} }
symread = 1;
return; return;
case RC_NOTIFY: case RC_NOTIFY:
@ -382,15 +383,17 @@ process_internal_message(int reply_code, const char *name)
case RC_TABLE_NAME: flag = CLI_SF_TABLE; break; case RC_TABLE_NAME: flag = CLI_SF_TABLE; break;
case RC_TEMPLATE_NAME: flag = CLI_SF_TEMPLATE; break; case RC_TEMPLATE_NAME: flag = CLI_SF_TEMPLATE; break;
case RC_INTERFACE_NAME: flag = CLI_SF_INTERFACE; break; case RC_INTERFACE_NAME: flag = CLI_SF_INTERFACE; break;
case RC_DUMP_DONE: symread = 0; return;
default: default:
printf("Undefined %d: %s", reply_code, name); printf("Undefined %d: %s", reply_code, name);
return; return;
} }
if (flag && name && *name) { if (flag && name && *name)
symread = 1; if (symread)
add_to_symbols(flag, name); add_to_symbols(flag, name);
} else
printf("Unexpected symbol definition %d: %s", reply_code, name);
} }
#define PRINTF(LEN, PARGS...) do { if (!skip_input && !complete) len = printf(PARGS); } while(0) #define PRINTF(LEN, PARGS...) do { if (!skip_input && !complete) len = printf(PARGS); } while(0)
@ -419,8 +422,7 @@ server_got_reply(char *x)
else if (code) else if (code)
{ {
PRINTF(len, "%s\n", verbose ? x : x+5); PRINTF(len, "%s\n", verbose ? x : x+5);
} else if (symread) }
symread = 0;
if (x[4] == ' ') if (x[4] == ' ')
{ {

View File

@ -73,7 +73,7 @@ enum reply_code {
RC_SHOW_RIP_INTERFACE = 1021, RC_SHOW_RIP_INTERFACE = 1021,
RC_SHOW_RIP_NEIGHBORS = 1022, RC_SHOW_RIP_NEIGHBORS = 1022,
RC_BIRD_VERSION_NUM = 3000, RC_BIRD_VERSION_NUM = 3000, /* This begins the symbol dump */
RC_TABLE_NAME = 3001, RC_TABLE_NAME = 3001,
RC_PROTOCOL_NAME = 3002, RC_PROTOCOL_NAME = 3002,
RC_FILTER_NAME = 3003, RC_FILTER_NAME = 3003,
@ -82,7 +82,8 @@ 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_DUMP_DONE = 3009, /* This ends the symbol dump */
RC_NOTIFY = 3010, /* 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,

View File

@ -113,7 +113,7 @@ cmd_send_symbols(void)
if (!(i->flags & IF_SHUTDOWN)) if (!(i->flags & IF_SHUTDOWN))
cli_msg(RC_INTERFACE_NAME, "\"%s\"", i->name); cli_msg(RC_INTERFACE_NAME, "\"%s\"", i->name);
cli_msg(0, ""); cli_msg(RC_DUMP_DONE, "");
} }
static void static void