⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mplsb10.c

📁 技术文件名称:MPLSv1.0软件模块测试规程
💻 C
📖 第 1 页 / 共 3 页
字号:
/********************************************************************          
*	Product Name:	MPLS                                       	          
*	Module  Name:	OAM    	 									
*	File    Name:   mplsb10.c								        	          
*	Function    :	function only for ZXB10 
*   History:
*   Date          Version        modifier         Activities 
* ==================================================================
*   01-8-9         2.1.2        Sun Baoping        create		
*   2002-11-23      sbp    修改提示信息                             *
*   2002.11.28      Sbp    处理配置检测函数与数据无关,流量配置数据关联紧密
*   sbp  2003-1-16  同一优先级同一目的地只能建10调TUNNEL
* 2003.6.24 Wengqing 增加对M2K的支持     
* 2003-7-8 szh add 增加错误号和打印信息 
* 2003-11-6 lixia mod mplsLspResMsgNo                               *
*   2003-11-12 szh mod MplsPortDataTable1代替MplsPortDataTable                              *
********************************************************************/ 
#include "string.h" 
#include "stdlib.h"
#include "stdio.h"
#include "memory.h"
#include "malloc.h"

#include "mplstype.h"
#include "mplstype1.h"
#include "protocol/h/exec_cmd.h"
#include "mplsfun.h"
#include "mplserr.h"
#include "mplsni.h"

extern ushort currentLspId;
extern mplsPort_t          MplsPortDataTable1;
extern mplsErLspTable_t		*curLsp;

/************************************************************************
 * FUNCTION NAME  : mplsLspResMsgNo()	                            
 * DESCRIPTION:   : warning during setupping and deleting lsp  			    
 *  INPUT         : sty:   struct for showing
 *                  ResMsgNo: Message No                            				
 *  OUTPUT        : NONE		                           				
 *  AUTHOR/DATE   : Sun Baoping/ 01.12.12                               
 *  GLOBAL        : NONE								
 *  NOTE          :  ..                                                 
/************************************************************************/
int16 mplsLspResMsgNo(struct sty *sty,int16 ResMsgNo)
{
   if(ResMsgNo==MPLS_SDP_CMD_SUCCESS)
       return SDP_CMD_SUCCESS;
   else
   {
   	   switch(ResMsgNo)
   	   {
   	      case MPLS_TUNN_LSP_PATH_EXPLICIT_NOTES :
   	          {
   	              sdp_printf(sty, "  Multi-Hop must config explicit path-option.\n");
   	              break;
   	          }
   	      
   	      case MPLS_DELSERVICE_ERROR:
   	          {
   	              sdp_printf(sty, "  Please first delete traffic parameters all.\n");
   	              break;
   	          }
   	      case MPLS_DELCDR_ERROR:
   	          {
   	              sdp_printf(sty, "  Please first delete traffic cdr.\n");
   	              break;
   	          }
   	     case MPLS_DELCBS_ERROR:
   	          {
   	              sdp_printf(sty, "  Please first delete traffic cbs.\n");
   	              break;
   	          }
   	      case MPLS_LSPNO_ERROR_DONE: 
   	           {
   	              sdp_printf(sty, "  Please configure the LspId:%d.\n",currentLspId);
   	              break;
   	           }
          case MPLS_LSPID_NOT_SET: 
               {
   	              sdp_printf(sty, "  Please configure the LspId first.\n");
   	              break;
   	           }      
          case MPLS_TUNNEL_LSP_HOP_FULL:   
               {
   	              sdp_printf(sty,"   Reach max number of hops!\n");
   	              break;
   	           } 
          case MPLS_LSP_DELETED_NOT_EXITING:  
               {
   	              sdp_printf(sty,"  Lsp not found!\n");
   	              break;
   	           }
          case MPLS_LSP_TABLE_NULL:   
               {
   	              sdp_printf(sty,"  The LSP Table is null!\n");
   	              break;
   	           }
   	      case MPLS_LSP_PREEMT_ERROR:
   	           {
   	              sdp_printf(sty,"  The setup priority of LSP should not be larger than holding priority!\n  0 is the highest priority; 7 is the lowest priority\n");
   	              break;
   	           }
   	      case MPLS_LSP_ADDR_REPEAT_ERROR: 
   	           {
   	              sdp_printf(sty,"  The net address has been setup.\n");
   	              break;
   	           }
   	      case MPLS_LSP_TYPE_ERROR:  /* LSP TYPE ERROR  ADD SBP 2001-12-21 */
   	           {
   	              sdp_printf(sty,"  LSP type is error.\n");
   	              break;
   	           } 
   	      case MPLS_MEMERY_ALLOCAT_ERROR:     /* MEMERY ALLOCAT ERROR  ADD SBP 2001-12-21 */
   	           {
   	              sdp_printf(sty,"  Memory Insufficient!\n");
   	              break;
   	           }
   	      case MPLS_CR_LSP_QOS_BINDING_WARNING_DELETE:     /*   ADD SBP 2001-12-21 */
   	           {
   	              sdp_printf(sty,"  Please delete the binding connection between QoS filter and the LSP first.\n");
   	              break;
   	           }
   	      case MPLS_CRLSP_COS_NOT_CONFIG:  /* COS OF CR LSP IS NOT CONFIGURED  SBP 2001-12-27 */
   	           {
   	              sdp_printf(sty,"   The service type not configured!\n");
   	              break;
   	           }
   	      case MPLS_CANNOT_COFIG_PARAMETER:  /* THIS PARAMETER CAN NOT BE CONFIGURED  SBP 2001-12-27 */
   	           {
   	              sdp_printf(sty,"  This parameter may not be configured because of the specified CoS.\n");
   	              break;
   	           }
   	      case MPLS_CRLSP_RTVBR_PDR_LAGER_CDR:  /* pdr > cdr when cos is rtVBR   sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  PDR should be larger than %d.\n",curLsp->traffic.ErLspCdr);
   	              break;
   	           }
   	      case MPLS_CRLSP_RTVBR_PBS_NOT_SMALLER_CBS:  /* PBS >= CBS when cos is rtVBR   sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  PBS should not be smaller than %d.\n",curLsp->traffic.ErlspCbs);
   	              break;
   	           }
   	      case MPLS_CRLSP_EBS_EQUAL_ZERO: /* EBS == 0  SBP 2001-12-27 */
   	           {
   	              sdp_printf(sty,"  EBS should be 0.\n");
   	              break;
   	           }
   	      case MPLS_CRLSP_RTVBR_CDR_SMALLER_PDR:  /* CDR < PDR when cos is rtVBR   sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  CDR should be smaller than %d.\n",curLsp->traffic.ErlspPdr);
   	              break;
   	           }
   	      case MPLS_CRLSP_RTVBR_CBS_NOT_LARGER_PBS: /* CBS<=PBS  when cos is rtVBR  SBP 2001-12-27 */
   	           {
   	              sdp_printf(sty,"  CBS should not be larger than %d.\n",curLsp->traffic.ErlspPbs);
   	              break;
   	           }
   	      case MPLS_CRLSP_CBR_CDR_EQUAL_PDR: /* cdr==pdr when cos is cbr    sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  CDR should be %d.\n",curLsp->traffic.ErlspPdr);
   	              break;
   	           }
   	      case MPLS_CRLSP_CBR_CBS_EQUAL_PBS: /* CBS==PBS when cos is cbr    sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  CBS should be %d.\n",curLsp->traffic.ErlspPbs);
   	              break;
   	           }
   	      case MPLS_CRLSP_UBR_CDR_EQUAL_ZERO: /* cdr==0 when cos is UBR      sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  CDR should be 0.\n");
   	              break;
   	           }
   	      case MPLS_CRLSP_UBR_CBS_EQUAL_ZERO: /* CBS==0 when cos is UBR      sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  CBS should be 0.\n");
   	              break;
   	           }
   	      case MPLS_CRLSP_VERY_FREQUENCY: /*   sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  Frequency should be very frequent : 2.\n");
   	              break;
   	           }
   	      case MPLS_CRLSP_FREQUENCY_UNSPECIFIED: /*  sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  Frequency should be unspecified : 0.\n");
   	              break;
   	           }
   	      case MPLS_CRLSP_FREQUENCY: /*    sbp 2001-12-27  */
   	           {
   	              sdp_printf(sty,"  Frequency should be frequent : 1.\n");
   	              break;
   	           }
   	      case MPLS_LSP_NOT_CHANGE:
   	           {
   	              sdp_printf(sty,"  This item should not be modified.\n");
   	              break;
   	           }
   	      case MPLS_LSP_FULL:
   	           {
   	              sdp_printf(sty,"  Tunnel is full!\n");
   	              break;
   	           }   	           
   	      case MPLS_TUNNEL_HOP_NOT_EXIST:
   	           {
   	              sdp_printf(sty,"   Hop address not exist!\n");
   	              break;
   	           }     
   	      case MPLS_TUNNEL_DST_NOT_LASTHOP:
   	           {
   	              sdp_printf(sty,"   Last hop address is not the same as destination!\n");
   	              break;
   	           } 
   	      case MPLS_TUNNEL_HOP_EXIST:
   	           {
   	              sdp_printf(sty,"   Can not configure the same hop number again!\n");
   	              break;
   	           } 
   	      case MPLS_TUNNEL_LSP_PRIO_DST_BEYOND_10:
   	           {
   	              sdp_printf(sty,"   The number of tunnels with the same metric to the same destination should be\n   smaller than 11!\n");
   	              break;
   	           } 
   	      case MPLS_POLICY_MEMORY_FAIL:    /* lixia add 2003-11-6 */
   	           {
   	              sdp_printf(sty,"   Can not allocate memory for g_policy_list!\n");
   	              break;
   	           }
   	      case MPLS_POLICY_FULL:          /* lixia mod 2003-11-6 */
   	           {
   	              sdp_printf(sty,"   Now the configed policy is 256,can not config more!\n");
   	              break;
   	           }   
   	       case MPLS_POLICY_PERMIT_FULL:  /* lixia add 2003-11-6 */
   	           {
   	              sdp_printf(sty,"   The system supports up to 128 policy,if config more,it may cause problem!\n"); 
   	      	      ResMsgNo = SDP_CMD_SUCCESS;
   	              break;
   	           }    	               
   	      case MPLS_POLICY_NEED_INFER:
   	          {
   	      	     /* sdp_printf(sty,"   Policy changes,please restart routing protocols for fec change!\n");*/
   	      	      ResMsgNo = SDP_CMD_SUCCESS;
   	              break;
   	          }     
   	      case MPLS_ENCAPSULATION:
   	          {
   	      	      sdp_printf(sty,"   change encapsulation mode,please restart mpls ip in global config mode!\n");
   	      	      ResMsgNo = SDP_CMD_SUCCESS;
   	              break;
   	          } 
             case MPLS_POLICY_NEED_ENABLE:
   	          {
   	      	      sdp_printf(sty,"   No policy exists,please enter mpls policy enable!\n");
   	      	      ResMsgNo = SDP_CMD_SUCCESS;
   	              break;
   	          } 
          default:
              break; 
   	   }
   	   
   	   return ResMsgNo;
   }
}
/************************************************************************
 * FUNCTION NAME  : mplsFecFilterRetMsgNo()	                            
 * DESCRIPTION:   : warning during setupping and deleting FEC policy  			    
 *  INPUT         : sty:   struct for showing
 *                  ResMsgNo: Message No                            				
 *  OUTPUT        : NONE		                           				
 *  AUTHOR/DATE   : Sun Baoping/ 01.12.12                               
 *  GLOBAL        : NONE								
 *  NOTE          :  ..                                                 
/************************************************************************/
int16 mplsFecFilterRetMsgNo(struct sty *sty,int16 ResMsgNo)
{
   if(ResMsgNo==MPLS_SDP_CMD_SUCCESS)
       return SDP_CMD_SUCCESS;
   else
   {
   	   switch(ResMsgNo)
   	   {
   	      case MPLS_OAM_ACL_PERMIT_ERROR: 
   	           {
   	              sdp_printf(sty, "  The address has been permited.\n");
   	              break;
   	           }
          case MPLS_OAM_ACL_DENY_ERROR: 
               {
   	              sdp_printf(sty, "  The address has been denied. \n");
   	              break;
   	           }      
          case MPLS_OAM_CMD_NOT_DONE:   
               {
   	              sdp_printf(sty,"  Sorry! neither normal command nor no command !\n");
   	              break;
   	           } 
   	      case MPLS_LSP_ADDR_REPEAT_ERROR: 
   	           {
   	              sdp_printf(sty,"  Sorry! The net address has been setup.\n");
   	              break;
   	           }
   	      case MPLS_MEMERY_ALLOCAT_ERROR:     /* MEMORY ALLOCAT ERROR  ADD SBP 2001-12-21 */
   	           {
   	              sdp_printf(sty,"  Sorry! Insufficient memory available.\n");
   	              break;
   	           }
          default:
              break; 
   	   }
   	   
   	   return ResMsgNo;
   }
}
/************************************************************************
 * FUNCTION NAME  : mplsCommonErrorMsg()	                            
 * DESCRIPTION:   : comman warning   			    
 *  INPUT         : sty:   struct for showing
 *                  ResMsgNo: Message No                            				
 *  OUTPUT        : NONE		                           				
 *  AUTHOR/DATE   : Sun Baoping/ 01.12.12                               
 *  GLOBAL        : NONE								

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -