|
|
| version 1.1.1.2, 2012/10/09 09:22:29 | version 1.1.1.3, 2013/07/21 23:54:41 |
|---|---|
| Line 61 struct vtysh_client | Line 61 struct vtysh_client |
| { .fd = -1, .name = "babeld", .flag = VTYSH_BABELD, .path = BABEL_VTYSH_PATH}, | { .fd = -1, .name = "babeld", .flag = VTYSH_BABELD, .path = BABEL_VTYSH_PATH}, |
| }; | }; |
| #define VTYSH_INDEX_MAX (sizeof(vtysh_client)/sizeof(vtysh_client[0])) | |
| /* We need direct access to ripd to implement vtysh_exit_ripd_only. */ | /* We need direct access to ripd to implement vtysh_exit_ripd_only. */ |
| static struct vtysh_client *ripd_client = NULL; | static struct vtysh_client *ripd_client = NULL; |
| Line 374 vtysh_execute_func (const char *line, int pager) | Line 373 vtysh_execute_func (const char *line, int pager) |
| if (! strcmp(cmd->string,"configure terminal")) | if (! strcmp(cmd->string,"configure terminal")) |
| { | { |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| { | { |
| cmd_stat = vtysh_client_execute(&vtysh_client[i], line, fp); | cmd_stat = vtysh_client_execute(&vtysh_client[i], line, fp); |
| if (cmd_stat == CMD_WARNING) | if (cmd_stat == CMD_WARNING) |
| Line 413 vtysh_execute_func (const char *line, int pager) | Line 412 vtysh_execute_func (const char *line, int pager) |
| } | } |
| cmd_stat = CMD_SUCCESS; | cmd_stat = CMD_SUCCESS; |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| { | { |
| if (cmd->daemon & vtysh_client[i].flag) | if (cmd->daemon & vtysh_client[i].flag) |
| { | { |
| Line 525 vtysh_config_from_file (struct vty *vty, FILE *fp) | Line 524 vtysh_config_from_file (struct vty *vty, FILE *fp) |
| u_int i; | u_int i; |
| int cmd_stat = CMD_SUCCESS; | int cmd_stat = CMD_SUCCESS; |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| { | { |
| if (cmd->daemon & vtysh_client[i].flag) | if (cmd->daemon & vtysh_client[i].flag) |
| { | { |
| Line 1354 DEFUN (vtysh_show_memory, | Line 1353 DEFUN (vtysh_show_memory, |
| int ret = CMD_SUCCESS; | int ret = CMD_SUCCESS; |
| char line[] = "show memory\n"; | char line[] = "show memory\n"; |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| if ( vtysh_client[i].fd >= 0 ) | if ( vtysh_client[i].fd >= 0 ) |
| { | { |
| fprintf (stdout, "Memory statistics for %s:\n", | fprintf (stdout, "Memory statistics for %s:\n", |
| Line 1377 DEFUN (vtysh_show_logging, | Line 1376 DEFUN (vtysh_show_logging, |
| int ret = CMD_SUCCESS; | int ret = CMD_SUCCESS; |
| char line[] = "show logging\n"; | char line[] = "show logging\n"; |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| if ( vtysh_client[i].fd >= 0 ) | if ( vtysh_client[i].fd >= 0 ) |
| { | { |
| fprintf (stdout,"Logging configuration for %s:\n", | fprintf (stdout,"Logging configuration for %s:\n", |
| Line 1733 DEFUN (vtysh_write_terminal, | Line 1732 DEFUN (vtysh_write_terminal, |
| VTY_NEWLINE); | VTY_NEWLINE); |
| vty_out (vty, "!%s", VTY_NEWLINE); | vty_out (vty, "!%s", VTY_NEWLINE); |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| ret = vtysh_client_config (&vtysh_client[i], line); | ret = vtysh_client_config (&vtysh_client[i], line); |
| /* Integrate vtysh specific configuration. */ | /* Integrate vtysh specific configuration. */ |
| Line 1807 write_config_integrated(void) | Line 1806 write_config_integrated(void) |
| return CMD_SUCCESS; | return CMD_SUCCESS; |
| } | } |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| ret = vtysh_client_config (&vtysh_client[i], line); | ret = vtysh_client_config (&vtysh_client[i], line); |
| vtysh_config_dump (fp); | vtysh_config_dump (fp); |
| Line 1844 DEFUN (vtysh_write_memory, | Line 1843 DEFUN (vtysh_write_memory, |
| fprintf (stdout,"Building Configuration...\n"); | fprintf (stdout,"Building Configuration...\n"); |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| ret = vtysh_client_execute (&vtysh_client[i], line, stdout); | ret = vtysh_client_execute (&vtysh_client[i], line, stdout); |
| fprintf (stdout,"[OK]\n"); | fprintf (stdout,"[OK]\n"); |
| Line 1934 DEFUN (vtysh_show_daemons, | Line 1933 DEFUN (vtysh_show_daemons, |
| { | { |
| u_int i; | u_int i; |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| if ( vtysh_client[i].fd >= 0 ) | if ( vtysh_client[i].fd >= 0 ) |
| vty_out(vty, " %s", vtysh_client[i].name); | vty_out(vty, " %s", vtysh_client[i].name); |
| vty_out(vty, "%s", VTY_NEWLINE); | vty_out(vty, "%s", VTY_NEWLINE); |
| Line 2184 vtysh_connect_all(const char *daemon_name) | Line 2183 vtysh_connect_all(const char *daemon_name) |
| int rc = 0; | int rc = 0; |
| int matches = 0; | int matches = 0; |
| for (i = 0; i < VTYSH_INDEX_MAX; i++) | for (i = 0; i < array_size(vtysh_client); i++) |
| { | { |
| if (!daemon_name || !strcmp(daemon_name, vtysh_client[i].name)) | if (!daemon_name || !strcmp(daemon_name, vtysh_client[i].name)) |
| { | { |