Annotation of embedaddon/quagga/pimd/pim_vty.c, revision 1.1

1.1     ! misho       1: /*
        !             2:   PIM for Quagga
        !             3:   Copyright (C) 2008  Everton da Silva Marques
        !             4: 
        !             5:   This program is free software; you can redistribute it and/or modify
        !             6:   it under the terms of the GNU General Public License as published by
        !             7:   the Free Software Foundation; either version 2 of the License, or
        !             8:   (at your option) any later version.
        !             9: 
        !            10:   This program is distributed in the hope that it will be useful, but
        !            11:   WITHOUT ANY WARRANTY; without even the implied warranty of
        !            12:   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
        !            13:   General Public License for more details.
        !            14:   
        !            15:   You should have received a copy of the GNU General Public License
        !            16:   along with this program; see the file COPYING; if not, write to the
        !            17:   Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
        !            18:   MA 02110-1301 USA
        !            19:   
        !            20:   $QuaggaId: $Format:%an, %ai, %h$ $
        !            21: */
        !            22: 
        !            23: #include <zebra.h>
        !            24: 
        !            25: #include "if.h"
        !            26: #include "linklist.h"
        !            27: 
        !            28: #include "pimd.h"
        !            29: #include "pim_vty.h"
        !            30: #include "pim_iface.h"
        !            31: #include "pim_cmd.h"
        !            32: #include "pim_str.h"
        !            33: #include "pim_ssmpingd.h"
        !            34: #include "pim_pim.h"
        !            35: 
        !            36: int pim_debug_config_write(struct vty *vty)
        !            37: {
        !            38:   int writes = 0;
        !            39: 
        !            40:   if (PIM_DEBUG_IGMP_EVENTS) {
        !            41:     vty_out(vty, "debug igmp events%s", VTY_NEWLINE);
        !            42:     ++writes;
        !            43:   }
        !            44:   if (PIM_DEBUG_IGMP_PACKETS) {
        !            45:     vty_out(vty, "debug igmp packets%s", VTY_NEWLINE);
        !            46:     ++writes;
        !            47:   }
        !            48:   if (PIM_DEBUG_IGMP_TRACE) {
        !            49:     vty_out(vty, "debug igmp trace%s", VTY_NEWLINE);
        !            50:     ++writes;
        !            51:   }
        !            52: 
        !            53:   if (PIM_DEBUG_MROUTE) {
        !            54:     vty_out(vty, "debug mroute%s", VTY_NEWLINE);
        !            55:     ++writes;
        !            56:   }
        !            57: 
        !            58:   if (PIM_DEBUG_PIM_EVENTS) {
        !            59:     vty_out(vty, "debug pim events%s", VTY_NEWLINE);
        !            60:     ++writes;
        !            61:   }
        !            62:   if (PIM_DEBUG_PIM_PACKETS) {
        !            63:     vty_out(vty, "debug pim packets%s", VTY_NEWLINE);
        !            64:     ++writes;
        !            65:   }
        !            66:   if (PIM_DEBUG_PIM_PACKETDUMP_SEND) {
        !            67:     vty_out(vty, "debug pim packet-dump send%s", VTY_NEWLINE);
        !            68:     ++writes;
        !            69:   }
        !            70:   if (PIM_DEBUG_PIM_PACKETDUMP_RECV) {
        !            71:     vty_out(vty, "debug pim packet-dump receive%s", VTY_NEWLINE);
        !            72:     ++writes;
        !            73:   }
        !            74:   if (PIM_DEBUG_PIM_TRACE) {
        !            75:     vty_out(vty, "debug pim trace%s", VTY_NEWLINE);
        !            76:     ++writes;
        !            77:   }
        !            78: 
        !            79:   if (PIM_DEBUG_ZEBRA) {
        !            80:     vty_out(vty, "debug pim zebra%s", VTY_NEWLINE);
        !            81:     ++writes;
        !            82:   }
        !            83: 
        !            84:   if (PIM_DEBUG_SSMPINGD) {
        !            85:     vty_out(vty, "debug ssmpingd%s", VTY_NEWLINE);
        !            86:     ++writes;
        !            87:   }
        !            88: 
        !            89:   return writes;
        !            90: }
        !            91: 
        !            92: int pim_global_config_write(struct vty *vty)
        !            93: {
        !            94:   int writes = 0;
        !            95: 
        !            96:   if (PIM_MROUTE_IS_ENABLED) {
        !            97:     vty_out(vty, "%s%s", PIM_CMD_IP_MULTICAST_ROUTING, VTY_NEWLINE);
        !            98:     ++writes;
        !            99:   }
        !           100: 
        !           101:   if (qpim_ssmpingd_list) {
        !           102:     struct listnode *node;
        !           103:     struct ssmpingd_sock *ss;
        !           104:     vty_out(vty, "!%s", VTY_NEWLINE);
        !           105:     ++writes;
        !           106:     for (ALL_LIST_ELEMENTS_RO(qpim_ssmpingd_list, node, ss)) {
        !           107:       char source_str[100];
        !           108:       pim_inet4_dump("<src?>", ss->source_addr, source_str, sizeof(source_str));
        !           109:       vty_out(vty, "ip ssmpingd %s%s", source_str, VTY_NEWLINE);
        !           110:       ++writes;
        !           111:     }
        !           112:   }
        !           113: 
        !           114:   return writes;
        !           115: }
        !           116: 
        !           117: int pim_interface_config_write(struct vty *vty)
        !           118: {
        !           119:   int writes = 0;
        !           120:   struct listnode *node;
        !           121:   struct interface *ifp;
        !           122: 
        !           123:   for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) {
        !           124: 
        !           125:     /* IF name */
        !           126:     vty_out(vty, "interface %s%s", ifp->name, VTY_NEWLINE);
        !           127:     ++writes;
        !           128: 
        !           129:     if (ifp->info) {
        !           130:       struct pim_interface *pim_ifp = ifp->info;
        !           131: 
        !           132:       /* IF ip pim ssm */
        !           133:       if (PIM_IF_TEST_PIM(pim_ifp->options)) {
        !           134:        vty_out(vty, " ip pim ssm%s", VTY_NEWLINE);
        !           135:        ++writes;
        !           136:       }
        !           137: 
        !           138:       /* IF ip pim drpriority */
        !           139:       if (pim_ifp->pim_dr_priority != PIM_DEFAULT_DR_PRIORITY) {
        !           140:        vty_out(vty, " ip pim drpriority %d%s", pim_ifp->pim_dr_priority,
        !           141:                VTY_NEWLINE);
        !           142:        ++writes;
        !           143:       }
        !           144: 
        !           145:       /* IF ip pim hello */
        !           146:       if (pim_ifp->pim_hello_period != PIM_DEFAULT_HELLO_PERIOD) {
        !           147:        vty_out(vty, " ip pim hello %d", pim_ifp->pim_hello_period);
        !           148:        if (pim_ifp->pim_default_holdtime != -1)
        !           149:          vty_out(vty, " %d", pim_ifp->pim_default_holdtime);
        !           150:        vty_out(vty, "%s", VTY_NEWLINE);
        !           151:       }
        !           152: 
        !           153:       /* IF ip igmp */
        !           154:       if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
        !           155:        vty_out(vty, " ip igmp%s", VTY_NEWLINE);
        !           156:        ++writes;
        !           157:       }
        !           158: 
        !           159:       /* IF ip igmp query-interval */
        !           160:       if (pim_ifp->igmp_default_query_interval != IGMP_GENERAL_QUERY_INTERVAL)
        !           161:        {
        !           162:          vty_out(vty, " %s %d%s",
        !           163:                  PIM_CMD_IP_IGMP_QUERY_INTERVAL,
        !           164:                  pim_ifp->igmp_default_query_interval,
        !           165:                  VTY_NEWLINE);
        !           166:          ++writes;
        !           167:        }
        !           168: 
        !           169:       /* IF ip igmp query-max-response-time */
        !           170:       if (pim_ifp->igmp_query_max_response_time_dsec != IGMP_QUERY_MAX_RESPONSE_TIME_DSEC)
        !           171:        {
        !           172:          vty_out(vty, " %s %d%s",
        !           173:                  PIM_CMD_IP_IGMP_QUERY_MAX_RESPONSE_TIME_DSEC,
        !           174:                  pim_ifp->igmp_query_max_response_time_dsec,
        !           175:                  VTY_NEWLINE);
        !           176:          ++writes;
        !           177:        }
        !           178: 
        !           179:       /* IF ip igmp join */
        !           180:       if (pim_ifp->igmp_join_list) {
        !           181:        struct listnode *node;
        !           182:        struct igmp_join *ij;
        !           183:        for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_join_list, node, ij)) {
        !           184:          char group_str[100];
        !           185:          char source_str[100];
        !           186:          pim_inet4_dump("<grp?>", ij->group_addr, group_str, sizeof(group_str));
        !           187:          pim_inet4_dump("<src?>", ij->source_addr, source_str, sizeof(source_str));
        !           188:          vty_out(vty, " ip igmp join %s %s%s",
        !           189:                  group_str, source_str,
        !           190:                  VTY_NEWLINE);
        !           191:          ++writes;
        !           192:        }
        !           193:       }
        !           194:     }
        !           195:     vty_out(vty, "!%s", VTY_NEWLINE);
        !           196:     ++writes;
        !           197:   }
        !           198: 
        !           199:   return writes;
        !           200: }

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