📄 api_test.c
字号:
}
/* copy output label link */
forward_table_show.forwart_t_value[array_index].remoteNum = tmp_forward_item->output_label_num;
{
uchar tmp_num;
output_label_link *tmp_label_link;
tmp_label_link = tmp_forward_item->output_label_group;
for(tmp_num=0; (tmp_num<tmp_forward_item->output_label_num)&&(tmp_num<MPLS_LBL_BINDS_MAX); tmp_num ++){
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.type =
tmp_label_link->output_label->label_value.type;
/* copy output label value */
switch( tmp_label_link->output_label->label_value.type){
case GEN_LABEL_TYPE:
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.label.label =
tmp_label_link->output_label->label_value.gen_label;
break;
case ATM_LABEL_TYPE:
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.label.atm.vpi =
tmp_label_link->output_label->label_value.atm_label.vpi;
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.label.atm.vci =
tmp_label_link->output_label->label_value.atm_label.vci;
break;
default:
break;
}
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].nextHop =
tmp_forward_item->dest_addr;
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.module =
tmp_label_link->output_label->label_if.module;
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.port =
tmp_label_link->output_label->label_if.port;
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.lsrType =
tmp_label_link->output_label->label_if.lsrType;
tmp_label_link = tmp_label_link->next;
}/* end of for output label num */
}/* end of local broad */
/* get net forward item in bi-link */
tmp_forward_item = tmp_forward_item->next;
array_index = array_index + 1;
}/* end of label foward table link */
/* set showed forward binding */
egress_num = array_index;
forward_table_show.oam_t_value.DataNum = array_index;
//start_index = init_start_index + array_index;
if( array_index >= MPLS_TABLE_SHOW_ITEM_LEN ){
forward_table_show.oam_t_value.DataNum = start_index;
//show_forward_table_sty(sty,forward_table_show,array_index);
//return array_index;
goto result_print;
}
/* copy INGRESS filter item */
for( i=0; (i<mpls_filter_item_num)&&(array_index<MPLS_TABLE_SHOW_ITEM_LEN)&&(tmp_filter_item!=NULL); i++){
/*
* added to show address and start types show mpls forwarding content
* xgxu:20021108
*/
switch(show_type){
case SHOW_ZERO:
/* go to next step */
break;
case SHOW_START:
if( (i + mpls_table_item_num)< start_index ){
tmp_filter_item = tmp_filter_item->bi_link_next;
continue;
}
break;
case SHOW_ADDR:
if( (parameter1 & parameter2)!=tmp_filter_item->qos_filter.mplsLdpFtnDestAddrMax ){
tmp_filter_item = tmp_filter_item->bi_link_next;
continue;
}
break;
default:
break;
}
forward_table_show.forwart_t_value[array_index].ifIndex = 0;
forward_table_show.forwart_t_value[array_index].localLabel.type =
INVALID_LABEL_TYPE;
/* copy input label */
/* needn't to copy input label in INGRESS label forward table */
/* copy output label */
forward_table_show.forwart_t_value[array_index].remoteNum = 1;
{
uchar tmp_num;
output_label_entity *tmp_output_label;
tmp_output_label = tmp_filter_item->output_label;
tmp_num = 0;
forward_table_show.forwart_t_value[array_index].remoteBinds[0].remoteBinds.type =
tmp_output_label->label_value.type;
/* copy output label value */
switch(tmp_output_label->label_value.type){
case GEN_LABEL_TYPE:
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.label.label =
tmp_output_label->label_value.gen_label;
break;
case ATM_LABEL_TYPE:
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.label.atm.vpi =
tmp_output_label->label_value.atm_label.vpi;
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.label.atm.vci =
tmp_output_label->label_value.atm_label.vci;
break;
default:
break;
}
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].nextHop =
tmp_filter_item->qos_filter.mplsLdpFtnDestAddrMax;
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.module =
tmp_output_label->label_if.module;
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.port =
tmp_output_label->label_if.port;
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.lsrType =
tmp_output_label->label_if.lsrType;
}/* end of local broad */
/* get next filter item */
array_index = array_index + 1;
tmp_filter_item = tmp_filter_item->bi_link_next;
}/* end of for INGRESS */
/* set next start index */
start_index = init_start_index + array_index;
if( array_index >= MPLS_TABLE_SHOW_ITEM_LEN ){
forward_table_show.oam_t_value.DataNum = start_index;
//show_forward_table_sty(sty,forward_table_show,array_index);
//return array_index;
goto result_print;
}
if( start_index >= mpls_filter_item_num + mpls_table_item_num ){
start_index = SHOW_FORWARD_RESULT_FLAG;
forward_table_show.oam_t_value.DataNum = start_index;
//show_forward_table_sty(sty,forward_table_show,array_index);
//return array_index;
goto result_print;
}
result_print:
{
total_array_index = array_index;
array_index = 0;
sdp_printf(sty, "==============================================================");
sdp_printf(sty, "\n");
sdp_printf(sty, " MPLS Forward Table ");
sdp_printf(sty, "\n");
sdp_printf(sty, " Total Forward Item:%d ",mpls_filter_item_num + mpls_table_item_num);
sdp_printf(sty, "\n");
sdp_printf(sty, " From:%d,%d Showed ",from_start_index,total_array_index);
sdp_printf(sty, "\n");
sdp_printf(sty, "INPUT LABEL\tOUTPUT LABEL\tDEST ADDR\tMODULE/PORT");
sdp_printf(sty, "\n");
sdp_printf(sty, "==============================================================");
sdp_printf(sty, "\n");
for( array_index=0; array_index<total_array_index; array_index++ ){
//sdp_printf(sty, "dest_addr:%x",);
//sdp_printf(sty, "local label type:%s",label_operate_string[forward_table_show.forwart_t_value[array_index].localLabel.type]);
//sdp_printf(sty, "\n");
switch(forward_table_show.forwart_t_value[array_index].localLabel.type){
case GEN_LABEL_TYPE:
sdp_printf(sty, "General:%3d",forward_table_show.forwart_t_value[array_index].localLabel.label.label);
break;
case ATM_LABEL_TYPE:
sdp_printf(sty, "VPI/VCI:%d/",forward_table_show.forwart_t_value[array_index].localLabel.label.atm.vpi);
sdp_printf(sty, "%d",forward_table_show.forwart_t_value[array_index].localLabel.label.atm.vci);
break;
default:
sdp_printf(sty, "INGRESS : ");
break;
}
{
uchar tmp_num;
for(tmp_num=0; (tmp_num<forward_table_show.forwart_t_value[array_index].remoteNum)&&(tmp_num<MPLS_LBL_BINDS_MAX); tmp_num ++){
if( tmp_num>=1 ){
sdp_printf(sty,"\t ");
}
/* copy output label value */
switch(forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.type){
case GEN_LABEL_TYPE:
sdp_printf(sty, "\tGeneral:%3d",forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.label.label);
sdp_printf(sty, "\t%-15s",
inettoa(forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].nextHop) );
sdp_printf(sty, "\t(%d/%d)",
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.module,
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.port);
break;
case ATM_LABEL_TYPE:
sdp_printf(sty, "\tVPI/VCI:%d/",forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.label.atm.vpi);
sdp_printf(sty, "%d",forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].remoteBinds.label.atm.vci);
sdp_printf(sty, "\t%-15s",
inettoa(forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].nextHop) );
sdp_printf(sty, "\t(%d/%d)",
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.module,
forward_table_show.forwart_t_value[array_index].remoteBinds[tmp_num].outIf.port);
break;
default:
sdp_printf(sty, "\tEGRESS: ");
break;
}
sdp_printf(sty, "\n");
}/* end of for output label num */
}/* end of local broad */
}/* end of for */
sdp_printf(sty, "==============================================================");
sdp_printf(sty, "\n");
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -