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

📄 mplsb10.c

📁 技术文件名称:MPLSv1.0软件模块测试规程
💻 C
📖 第 1 页 / 共 3 页
字号:
    {
    	 if( temp_module  > 8 || temp_module <=0||temp_port  > 8  ||temp_port < 1)
    	   return SDP_PARAM_NO_USE;
               }
               else
        return SDP_PARAM_NO_USE;
        
            return SDP_PARAM_CHAR ;
}
/************************************************************************
 * FUNCTION NAME  : sdp_check_pos_module_port_no()	                            
 * DESCRIPTION:   : check whether the POS modue and port no is right			    
 *  INPUT         : number : string inputted                           				
 *  OUTPUT        : special value or fail message		                           				
 *  AUTHOR/DATE   : Sun Baoping/ 01.12.12                               
 *  GLOBAL        : NONE						
 *  NOTE          :                                                 
/************************************************************************/
int16 sdp_check_pos_module_port_no(int8 * number)
{
    int16   val_len,count_num=0,count_num1=0;
    int8    * p_temp;
    int8    f_temp[3];
    int8    n_temp[3];
    int16   num,num1;  
    uchar   temp_module,temp_port;
    uchar   numFnd;

    memset(f_temp,0,sizeof(int8)*3);
    memset(n_temp,0,sizeof(int8)*3);
    p_temp=number;
    val_len=STRLEN(p_temp);
    while ((*p_temp >= '0') && (*p_temp <= '9'))
    {
    	f_temp[count_num]=*p_temp;
        p_temp++;
        count_num++;
    }
    if(*p_temp!='/')
       return SDP_PARAM_NO_USE;
    else
    {
       p_temp++;
       count_num++;
    }
    
    while ((*p_temp >= '0') && (*p_temp <= '9'))
    {
    	n_temp[count_num1]=*p_temp;
        p_temp++;
        count_num++;
        count_num1++;
    } 
    if ( count_num != val_len )  
        return SDP_PARAM_NO_USE;
    if(count_num>9)
        return SDP_PARAM_NO_USE;
    temp_module = attache_atoi( f_temp );
    temp_port   = attache_atoi( n_temp );

    numFnd = 0;
    
    if ( temp_module  > 13 || temp_module < 0||temp_port  > 13 || temp_port < 1)
        return SDP_PARAM_NO_USE;
    else{
        for(num=1; num<MplsPortDataTable1.num; num++)
        {
           if(MplsPortDataTable1.mplsModule[num].module == temp_module)
           {
               if(MplsPortDataTable1.mplsModule[num].cardType==19)
               {
                   for(num1=0; num1<MplsPortDataTable1.mplsModule[num].num; num1++)
                   {
                   	   if(MplsPortDataTable1.mplsModule[num].portData[num1].port==temp_port)
                   	   {
                   	       numFnd=1 ;
                   	       break;
                   	   }
                   }
               }
               
           }
        }
        
        if(numFnd==1)
            return SDP_PARAM_CHAR ;
        else
            return SDP_PARAM_NO_USE;
    }
}

/************************************************************************
* FUNCTION NAME  : sdp_check_tunnel_traffic_cbs()	                            
 * DESCRIPTION:   : check tunnel traffic cbs			    
 *  INPUT         : number : string inputted                           				
 *  OUTPUT        : special value or fail message		                           				
 *  AUTHOR/DATE   : Sun Baoping/ 01.12.12                               
 *  GLOBAL        : NONE						
 *  NOTE          :                                                 
/************************************************************************/
int16 sdp_check_tunnel_traffic_cbs(int8 * number)
{
    int16 val_len,count_num=0;
    int8 * p_temp;
    u_int32 temp_val;
    char  max[] = "4294967295";
    int   i, large = FALSE;

    p_temp=number;
    val_len=STRLEN(p_temp);
    if ( val_len > 10 ) 
        return SDP_PARAM_NO_USE;
  
    while ((*p_temp >= '0') && (*p_temp <= '9'))
    {
        p_temp++;
        count_num++;
    }
    if ( count_num != val_len )  return SDP_PARAM_NO_USE;
    
    /*对上界进行检测*/
    if(count_num == 10)
    {
    	for ( i=0; i< count_num; i++ )
    	{
    		if (max[i] > number[i])
    		{
    			large = FALSE;
    			break;
    		} 
    		else if (max[i] < number[i])
    		{
    			large = TRUE;
    			break;
    		} 
    		else
    		    continue;
    	}
    }
    else if(count_num > 10)
        large = TRUE;

    if ( large == TRUE )
        return SDP_PARAM_NO_USE;
    
    temp_val=atol( number );
    if ( temp_val > 4294967295 || temp_val < 0 )
        return SDP_PARAM_NO_USE;
    else
    {
    	if(curLsp->cos==SERVICE_TYPE_CBR)
    	{
    		if(temp_val ==curLsp->traffic.ErlspPbs)
    		  return SDP_PARAM_INT32;
    	}
    	else if(curLsp->cos==SERVICE_TYPE_UBR)
    	{
    	    if(temp_val==0)
    	      return SDP_PARAM_INT32;
    	}
    	else if(curLsp->cos==SERVICE_TYPE_RTVBR||curLsp->cos==SERVICE_TYPE_NRTVBR)
    	{
    		//if(temp_val<=curLsp->traffic.ErlspPbs) xjs,2003-7-18 11:55
    	    if(temp_val<=4294967295 &&temp_val>=2)
    	      return SDP_PARAM_INT32;
    	}
    	
        return SDP_PARAM_NO_USE;
    }
}

/************************************************************************
* FUNCTION NAME  : sdp_check_tunnel_traffic_cdr()	                            
 * DESCRIPTION:   : check tunnel traffic cdr			    
 *  INPUT         : number : string inputted                           				
 *  OUTPUT        : special value or fail message		                           				
 *  AUTHOR/DATE   : Sun Baoping/ 01.12.12                               
 *  GLOBAL        : NONE						
 *  NOTE          :                                                 
/************************************************************************/
int16 sdp_check_tunnel_traffic_cdr(int8 * number)
{
    int16 val_len,count_num=0;
    int8 * p_temp;
    u_int32 temp_val;
    char  max[] = "4294967295";
    int   i, large = FALSE;

    p_temp=number;
    val_len=STRLEN(p_temp);
    if ( val_len > 10 ) 
        return SDP_PARAM_NO_USE;
  
    while ((*p_temp >= '0') && (*p_temp <= '9'))
    {
        p_temp++;
        count_num++;
    }
    if ( count_num != val_len )  return SDP_PARAM_NO_USE;
    
    /*对上界进行检测*/
    if(count_num == 10)
    {
    	for ( i=0; i< count_num; i++ )
    	{
    		if (max[i] > number[i])
    		{
    			large = FALSE;
    			break;
    		} 
    		else if (max[i] < number[i])
    		{
    			large = TRUE;
    			break;
    		} 
    		else
    		    continue;
    	}
    }
    else if(count_num > 10)
        large = TRUE;

    if ( large == TRUE )
        return SDP_PARAM_NO_USE;
    
    temp_val=atol( number );
    if ( temp_val > 4294967295 || temp_val < 0 )
        return SDP_PARAM_NO_USE;
    else
    {
    	if(curLsp->cos==SERVICE_TYPE_CBR)
    	{
    		if(temp_val ==curLsp->traffic.ErlspPdr)
    		  return SDP_PARAM_INT32;
    	}
    	else if(curLsp->cos==SERVICE_TYPE_UBR)
    	{
    	    if(temp_val==0)
    	      return SDP_PARAM_INT32;
    	}
    	else if(curLsp->cos==SERVICE_TYPE_RTVBR||curLsp->cos==SERVICE_TYPE_NRTVBR)
    	{
    		/*modify by xjs,2003-7-18 11:57*/
    	    if(temp_val<curLsp->traffic.ErlspPdr && temp_val >= 1)
    	      return SDP_PARAM_INT32;
    	}
    	
        return SDP_PARAM_NO_USE;
    }
}

/************************************************************************
 * FUNCTION NAME  : mplsTunnelTrafficHelpfunc()	                            
 * DESCRIPTION:   : help information for mpls tunnel traffic  			    
 *  INPUT         : sty:   struct for showing
 *                  ResMsgNo: Message No                            				
 *  OUTPUT        : NONE		                           				
 *  AUTHOR/DATE   : Sun Baoping/ 01.12.12                               
 *  GLOBAL        : NONE								
 *  NOTE          :  ..                                                 
*   2002-11-23      sbp    修改提示信息                             
 *  2003-7-18 11:23 xjs    修改提示信息                            
/************************************************************************/
int16 mplsTunnelTrafficHelpfunc(struct sty *sty,int16 ResMsgNo)
{
	
	if(ResMsgNo==429) /* cdr */
	{
	    if(curLsp->cos==SERVICE_TYPE_CBR)
    	{
    		if(curLsp->traffic.ErlspPdr==0)
    		{
    		    sdp_printf(sty," Please first config traffic pdr.\n");
    		}
    		else
    		{    
    		    sdp_printf(sty," <%u>           Cdr(cell/s)\n",curLsp->traffic.ErlspPdr);
    		}   
    	}
    	else if(curLsp->cos==SERVICE_TYPE_UBR)
    	{
    	    if(curLsp->traffic.ErlspPdr==0)
    		{
    		    sdp_printf(sty," Please first config traffic pdr.\n");
    		}
    		else
    		{
    	        sdp_printf(sty," <0>           Cdr(cell/s)\n");
    	    }    
    	}
    	else if(curLsp->cos==SERVICE_TYPE_RTVBR||curLsp->cos==SERVICE_TYPE_NRTVBR)
    	{
    	    if(curLsp->traffic.ErlspPdr==0)
    		{
    		    sdp_printf(sty," Please first config traffic pdr.\n");
    		}
    		else
    		{
    	        sdp_printf(sty," <1-%u>           Cdr(cell/s)\n",curLsp->traffic.ErlspPdr-1);
    	    }    
    	}
	}
	else if(ResMsgNo==431) /* cbs */
	{
	    if(curLsp->cos==SERVICE_TYPE_CBR)
    	{
    		sdp_printf(sty," <%u>           Cbs(us/10)\n",curLsp->traffic.ErlspPbs);
    	}
    	else if(curLsp->cos==SERVICE_TYPE_UBR)
    	{
    	    sdp_printf(sty," <0>           Cbs(cell)\n");
    	}
    	else if(curLsp->cos==SERVICE_TYPE_RTVBR||curLsp->cos==SERVICE_TYPE_NRTVBR)
    	{
    	    sdp_printf(sty," <2-4294967295>           Cbs(cell)\n");
    	}
    	  
	}
}

⌨️ 快捷键说明

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