当前位置: 首页>>代码示例>>Java>>正文


Java MatchField.equals方法代码示例

本文整理汇总了Java中org.projectfloodlight.openflow.protocol.match.MatchField.equals方法的典型用法代码示例。如果您正苦于以下问题:Java MatchField.equals方法的具体用法?Java MatchField.equals怎么用?Java MatchField.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.projectfloodlight.openflow.protocol.match.MatchField的用法示例。


在下文中一共展示了MatchField.equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: maskL4AndUp

import org.projectfloodlight.openflow.protocol.match.MatchField; //导入方法依赖的package包/类
/**
 * Create a point-to-point match for two devices at the IP layer.
 * Takes an existing match (e.g. from a PACKET_IN), and masks all
 * MatchFields leaving behind:
 * 		IN_PORT
 * 		VLAN_VID
 * 		ETH_TYPE
 * 		ETH_SRC
 * 		ETH_DST
 * 		IPV4_SRC
 * 		IPV4_DST
 * 		IP_PROTO (might remove this)
 * 
 * If one of the above MatchFields is wildcarded in Match m,
 * that MatchField will be wildcarded in the returned Match.
 * 
 * @param m The match to remove all L4+ MatchFields from
 * @return A new Match object with all MatchFields masked/wildcared
 * except for those listed above.
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Match maskL4AndUp(Match m) {
	Match.Builder mb = m.createBuilder(); 
	Iterator<MatchField<?>> itr = m.getMatchFields().iterator(); // only get exact or masked fields (not fully wildcarded)
	while(itr.hasNext()) {
		MatchField mf = itr.next();
		// restrict MatchFields only to L3 and below: IN_PORT, ETH_TYPE, ETH_SRC, ETH_DST, IPV4_SRC, IPV4_DST, IP_PROTO (this one debatable...)
		// if a MatchField is not in the access list below, it will not be set --> it will be left wildcarded (default)
		if (mf.equals(MatchField.IN_PORT) || mf.equals(MatchField.ETH_TYPE) || mf.equals(MatchField.ETH_SRC) || mf.equals(MatchField.ETH_DST) ||
				mf.equals(MatchField.IPV4_SRC) || mf.equals(MatchField.IPV4_DST) || mf.equals(MatchField.IP_PROTO)) {
			if (m.isExact(mf)) {
				mb.setExact(mf, m.get(mf));
			} else if (m.isPartiallyMasked(mf)) {
				mb.setMasked(mf, m.getMasked(mf));
			} else {
				// it's either exact, masked, or wildcarded
				// itr only contains exact and masked MatchFields
				// we should never get here
			} 
		}
	}
	return mb.build();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:44,代码来源:MatchUtils.java

示例2: maskL4AndUp

import org.projectfloodlight.openflow.protocol.match.MatchField; //导入方法依赖的package包/类
/**
 * Create a point-to-point match for two devices at the IP layer.
 * Takes an existing match (e.g. from a PACKET_IN), and masks all
 * MatchFields leaving behind:
 * 		IN_PORT
 * 		VLAN_VID
 * 		ETH_TYPE
 * 		ETH_SRC
 * 		ETH_DST
 * 		IPV4_SRC
 * 		IPV4_DST
 * 		IP_PROTO (might remove this)
 *
 * If one of the above MatchFields is wildcarded in Match m,
 * that MatchField will be wildcarded in the returned Match.
 *
 * @param m The match to remove all L4+ MatchFields from
 * @return A new Match object with all MatchFields masked/wildcared
 * except for those listed above.
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Match maskL4AndUp(Match m) {
	Match.Builder mb = m.createBuilder();
	Iterator<MatchField<?>> itr = m.getMatchFields().iterator(); // only get exact or masked fields (not fully wildcarded)
	while(itr.hasNext()) {
		MatchField mf = itr.next();
		// restrict MatchFields only to L3 and below: IN_PORT, ETH_TYPE, ETH_SRC, ETH_DST, IPV4_SRC, IPV4_DST, IP_PROTO (this one debatable...)
		// if a MatchField is not in the access list below, it will not be set --> it will be left wildcarded (default)
		if (mf.equals(MatchField.IN_PORT) || mf.equals(MatchField.ETH_TYPE) || mf.equals(MatchField.ETH_SRC) || mf.equals(MatchField.ETH_DST) ||
				mf.equals(MatchField.IPV4_SRC) || mf.equals(MatchField.IPV4_DST) || mf.equals(MatchField.IP_PROTO)) {
			if (m.isExact(mf)) {
				mb.setExact(mf, m.get(mf));
			} else if (m.isPartiallyMasked(mf)) {
				//mb.setMasked(mf, m.getMasked(mf));
				;//SXT------
			} else {
				// it's either exact, masked, or wildcarded
				// itr only contains exact and masked MatchFields
				// we should never get here
			}
		}
	}
	return mb.build();
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:45,代码来源:MatchUtils.java


注:本文中的org.projectfloodlight.openflow.protocol.match.MatchField.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。