去年的OPNET笔记整理,看看能坚持几篇?!
毕竟OPNET这个东西实在是太BT了,T__T
SV:
节点名:my_node_hname
路由器IP接口数:num_ip_interfaces
IP模块数据指针:ip_module_data_ptr
数据包指针:packet_ptr
FB:
MPLS标签处理,数据包转发:
static void mpls_mgr_packet_forward (MplsT_Forward_State* state_ptr, IpT_Rte_Ind_Ici_Fields* intf_ici_fdstruct_ptr)
解析配置的LSP参数,建立LSP,并绑定到FEC跟TRUNK:
static void mpls_mgr_lsps_parse ()
取路由器第i个接口的IP:
ip_intf_i_ptr = ip_rte_intf_tbl_access (ip_module_data_ptr, i); intf_i_ip = ip_rte_intf_addr_get (ip_intf_i_ptr); ip_address_print(str_intf_i_ip, intf_i_ip);
取数据包的源&目的IP地址:
if (op_pk_nfd_access (packet_ptr, "fields", &pk_fd_ptr) == OPC_COMPCODE_SUCCESS){ inet_address_print (str_src_addr, pk_fd_ptr->src_addr); inet_address_print (str_dest_addr, pk_fd_ptr->dest_addr); /* 协议号:pk_fd_ptr->protocol */ }
LSP的绑定笔记:
新建一个te_binding :
te_binding = (MplsT_TE_Binding*) op_prg_mem_alloc (sizeof (MplsT_TE_Binding));
如果有入接口信息就加进去:
op_prg_list_insert (te_binding->binded_ifaces_lptr, in_iface_ptr, OPC_LISTPOS_TAIL);
根据fec_name取得fecs_lptr:
te_binding->binded_fecs_lptr = (List*) oms_data_def_entry_access ("fecs", fec_name);
根据traffic_trunk_name设定te_binging对应的参数,并取指针:
strcpy(te_binding->binded_trunk_name,traffic_trunk_name); traffic_trunk_ptr = (MplsT_Traffic_Trunk*) oms_data_def_entry_access ("MPLS Traffic Trunks", te_binding->binded_trunk_name);
LSP注册:
mpls_support_registered_lsp_create (lsp_name, te_binding);
得到LSP信息指针:
lsp_info_ptr = mpls_support_lsp_info_get_from_name (lsp_name); path_attrs_ptr = (MplsT_Path_Attrs*) lsp_info_ptr->path_attrs;
静态LSP绑定:
if ((mpls_path_attrs_ptr->lsp_type == MplsC_Lsp_Type_Elsp) || (mpls_path_attrs_ptr->lsp_type == MplsC_Lsp_Type_Llsp)) { // ......FLM...... mpls_mgr_lsp_binding_create (lsp_name, weight, fec_lptr, label_space_handle, traffic_trunk_instance_ptr, in_iface, fec_name); }
动态LSP绑定:
else if ((path_attrs_ptr->lsp_type == MplsC_Lsp_Type_Dyn_Elsp) || (path_attrs_ptr->lsp_type == MplsC_Lsp_Type_Dyn_Llsp)) { //...... op_prg_list_insert (lsp_state_info_ptr->lsp_bindings_lptr, te_binding, OPC_LISTPOS_TAIL); //...... op_prg_list_insert (dynamic_lsps_lptr, dynamic_lsp_detail_ptr, OPC_LISTPOS_TAIL); }
没有评论:
发表评论