Diff for /embedaddon/quagga/vtysh/vtysh.c between versions 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2012/02/21 17:26:12 version 1.1.1.3, 2013/07/21 23:54:41
Line 58  struct vtysh_client Line 58  struct vtysh_client
   { .fd = -1, .name = "ospf6d", .flag = VTYSH_OSPF6D, .path = OSPF6_VTYSH_PATH},    { .fd = -1, .name = "ospf6d", .flag = VTYSH_OSPF6D, .path = OSPF6_VTYSH_PATH},
   { .fd = -1, .name = "bgpd", .flag = VTYSH_BGPD, .path = BGP_VTYSH_PATH},    { .fd = -1, .name = "bgpd", .flag = VTYSH_BGPD, .path = BGP_VTYSH_PATH},
   { .fd = -1, .name = "isisd", .flag = VTYSH_ISISD, .path = ISIS_VTYSH_PATH},    { .fd = -1, .name = "isisd", .flag = VTYSH_ISISD, .path = ISIS_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 373  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 412  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 524  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 797  static struct cmd_node ospf6_node = Line 797  static struct cmd_node ospf6_node =
   "%s(config-ospf6)# "    "%s(config-ospf6)# "
 };  };
   
   static struct cmd_node babel_node =
   {
     BABEL_NODE,
     "%s(config-babel)# "
   };
   
 static struct cmd_node keychain_node =  static struct cmd_node keychain_node =
 {  {
   KEYCHAIN_NODE,    KEYCHAIN_NODE,
Line 1009  DEFUNSH (VTYSH_OSPF6D, Line 1015  DEFUNSH (VTYSH_OSPF6D,
   return CMD_SUCCESS;    return CMD_SUCCESS;
 }  }
   
   DEFUNSH (VTYSH_BABELD,
            router_babel,
            router_babel_cmd,
            "router babel",
            ROUTER_STR
            "Babel")
   {
     vty->node = BABEL_NODE;
     return CMD_SUCCESS;
   }
   
 DEFUNSH (VTYSH_ISISD,  DEFUNSH (VTYSH_ISISD,
          router_isis,           router_isis,
          router_isis_cmd,           router_isis_cmd,
Line 1097  vtysh_exit (struct vty *vty) Line 1114  vtysh_exit (struct vty *vty)
     case RIPNG_NODE:      case RIPNG_NODE:
     case OSPF_NODE:      case OSPF_NODE:
     case OSPF6_NODE:      case OSPF6_NODE:
       case BABEL_NODE:
     case ISIS_NODE:      case ISIS_NODE:
     case MASC_NODE:      case MASC_NODE:
     case RMAP_NODE:      case RMAP_NODE:
Line 1335  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 1358  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 1714  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 1788  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 1825  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 1915  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 2165  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))
         {          {
Line 2252  vtysh_init_vty (void) Line 2270  vtysh_init_vty (void)
   install_node (&ripng_node, NULL);    install_node (&ripng_node, NULL);
   install_node (&ospf6_node, NULL);    install_node (&ospf6_node, NULL);
 /* #endif */  /* #endif */
     install_node (&babel_node, NULL);
   install_node (&keychain_node, NULL);    install_node (&keychain_node, NULL);
   install_node (&keychain_key_node, NULL);    install_node (&keychain_key_node, NULL);
   install_node (&isis_node, NULL);    install_node (&isis_node, NULL);
Line 2273  vtysh_init_vty (void) Line 2292  vtysh_init_vty (void)
   vtysh_install_default (OSPF_NODE);    vtysh_install_default (OSPF_NODE);
   vtysh_install_default (RIPNG_NODE);    vtysh_install_default (RIPNG_NODE);
   vtysh_install_default (OSPF6_NODE);    vtysh_install_default (OSPF6_NODE);
     vtysh_install_default (BABEL_NODE);
   vtysh_install_default (ISIS_NODE);    vtysh_install_default (ISIS_NODE);
   vtysh_install_default (KEYCHAIN_NODE);    vtysh_install_default (KEYCHAIN_NODE);
   vtysh_install_default (KEYCHAIN_KEY_NODE);    vtysh_install_default (KEYCHAIN_KEY_NODE);
Line 2327  vtysh_init_vty (void) Line 2347  vtysh_init_vty (void)
   install_element (RIPNG_NODE, &vtysh_end_all_cmd);    install_element (RIPNG_NODE, &vtysh_end_all_cmd);
   install_element (OSPF_NODE, &vtysh_end_all_cmd);    install_element (OSPF_NODE, &vtysh_end_all_cmd);
   install_element (OSPF6_NODE, &vtysh_end_all_cmd);    install_element (OSPF6_NODE, &vtysh_end_all_cmd);
     install_element (BABEL_NODE, &vtysh_end_all_cmd);
   install_element (BGP_NODE, &vtysh_end_all_cmd);    install_element (BGP_NODE, &vtysh_end_all_cmd);
   install_element (BGP_IPV4_NODE, &vtysh_end_all_cmd);    install_element (BGP_IPV4_NODE, &vtysh_end_all_cmd);
   install_element (BGP_IPV4M_NODE, &vtysh_end_all_cmd);    install_element (BGP_IPV4M_NODE, &vtysh_end_all_cmd);
Line 2352  vtysh_init_vty (void) Line 2373  vtysh_init_vty (void)
 #ifdef HAVE_IPV6  #ifdef HAVE_IPV6
   install_element (CONFIG_NODE, &router_ospf6_cmd);    install_element (CONFIG_NODE, &router_ospf6_cmd);
 #endif  #endif
     install_element (CONFIG_NODE, &router_babel_cmd);
   install_element (CONFIG_NODE, &router_isis_cmd);    install_element (CONFIG_NODE, &router_isis_cmd);
   install_element (CONFIG_NODE, &router_bgp_cmd);    install_element (CONFIG_NODE, &router_bgp_cmd);
   install_element (CONFIG_NODE, &router_bgp_view_cmd);    install_element (CONFIG_NODE, &router_bgp_view_cmd);

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>