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


Java MacAddress.isBroadcast方法代码示例

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


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

示例1: getSourceEntityFromPacket

import org.projectfloodlight.openflow.types.MacAddress; //导入方法依赖的package包/类
/**
 * Parse an entity from an {@link Ethernet} packet.
 * @param eth the packet to parse
 * @param sw the switch on which the packet arrived
 * @param pi the original packetin
 * @return the entity from the packet
 */
protected Entity getSourceEntityFromPacket(Ethernet eth, DatapathId swdpid, OFPort port) {
	MacAddress dlAddr = eth.getSourceMACAddress();

	// Ignore broadcast/multicast source
	if (dlAddr.isBroadcast() || dlAddr.isMulticast())
		return null;
	// Ignore 0 source mac
	if (dlAddr.getLong() == 0)
		return null;

	VlanVid vlan = VlanVid.ofVlan(eth.getVlanID());
	IPv4Address ipv4Src = getSrcIPv4AddrFromARP(eth, dlAddr);
	IPv6Address ipv6Src = ipv4Src.equals(IPv4Address.NONE) ? getSrcIPv6Addr(eth) : IPv6Address.NONE;
	return new Entity(dlAddr,
			vlan,
			ipv4Src,
			ipv6Src,
			swdpid,
			port,
			new Date());
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:29,代码来源:DeviceManagerImpl.java

示例2: getSourceEntityFromPacket

import org.projectfloodlight.openflow.types.MacAddress; //导入方法依赖的package包/类
/**
 * Parse an entity from an {@link Ethernet} packet.
 * @param eth the packet to parse
 * @param sw the switch on which the packet arrived
 * @param pi the original packetin
 * @return the entity from the packet
 */
protected Entity getSourceEntityFromPacket(Ethernet eth, DatapathId swdpid, OFPort port) {
	MacAddress dlAddr = eth.getSourceMACAddress();

	// Ignore broadcast/multicast source
	if (dlAddr.isBroadcast() || dlAddr.isMulticast())
		return null;
	// Ignore 0 source mac
	if (dlAddr.getLong() == 0)
		return null;

	VlanVid vlan = VlanVid.ofVlan(eth.getVlanID());
	IPv4Address nwSrc = getSrcNwAddr(eth, dlAddr);
	return new Entity(dlAddr,
			vlan,
			nwSrc,
			swdpid,
			port,
			new Date());
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:27,代码来源:DeviceManagerImpl.java

示例3: getDestEntityFromPacket

import org.projectfloodlight.openflow.types.MacAddress; //导入方法依赖的package包/类
/**
 * Get a (partial) entity for the destination from the packet.
 * @param eth
 * @return
 */
protected Entity getDestEntityFromPacket(Ethernet eth) {
	MacAddress dlAddr = eth.getDestinationMACAddress();
	VlanVid vlan = VlanVid.ofVlan(eth.getVlanID());
	IPv4Address nwDst = IPv4Address.NONE;

	// Ignore broadcast/multicast destination
	if (dlAddr.isBroadcast() || dlAddr.isMulticast())
		return null;
	// Ignore zero dest mac
	if (dlAddr.getLong() == 0)
		return null;

	if (eth.getPayload() instanceof IPv4) {
		IPv4 ipv4 = (IPv4) eth.getPayload();
		nwDst = ipv4.getDestinationAddress();
	}
	
	return new Entity(dlAddr,
			vlan,
			nwDst,
			null,
			null,
			null);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:30,代码来源:DeviceManagerImpl.java

示例4: learnDeviceFromArpResponseData

import org.projectfloodlight.openflow.types.MacAddress; //导入方法依赖的package包/类
/**
 * Learn device from ARP data in scenarios where the
 * Ethernet source MAC is different from the sender hardware
 * address in ARP data.
 */
protected void learnDeviceFromArpResponseData(Ethernet eth,
		DatapathId swdpid,
		OFPort port) {

	if (!(eth.getPayload() instanceof ARP)) return;
	ARP arp = (ARP) eth.getPayload();

	MacAddress dlAddr = eth.getSourceMACAddress();

	MacAddress senderAddr = arp.getSenderHardwareAddress();

	if (dlAddr.equals(senderAddr)) return; // arp request

	// Ignore broadcast/multicast source
	if (senderAddr.isBroadcast() || senderAddr.isMulticast())
		return;
	// Ignore zero sender mac
	if (senderAddr.equals(MacAddress.of(0)))
		return;

	VlanVid vlan = VlanVid.ofVlan(eth.getVlanID());
	IPv4Address nwSrc = arp.getSenderProtocolAddress();

	Entity e =  new Entity(senderAddr,
			vlan, /* will either be a valid tag or VlanVid.ZERO if untagged */
			nwSrc,
			IPv6Address.NONE, /* must be none for ARP */
			swdpid,
			port,
			new Date());

	learnDeviceByEntity(e);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:39,代码来源:DeviceManagerImpl.java

示例5: getDestEntityFromPacket

import org.projectfloodlight.openflow.types.MacAddress; //导入方法依赖的package包/类
/**
 * Get a (partial) entity for the destination from the packet.
 * @param eth
 * @return
 */
protected Entity getDestEntityFromPacket(Ethernet eth) {
	MacAddress dlAddr = eth.getDestinationMACAddress();
	VlanVid vlan = VlanVid.ofVlan(eth.getVlanID());
	IPv4Address ipv4Dst = IPv4Address.NONE;
	IPv6Address ipv6Dst = IPv6Address.NONE;

	// Ignore broadcast/multicast destination
	if (dlAddr.isBroadcast() || dlAddr.isMulticast())
		return null;
	// Ignore zero dest mac
	if (dlAddr.equals(MacAddress.of(0)))
		return null;

	if (eth.getPayload() instanceof IPv4) {
		IPv4 ipv4 = (IPv4) eth.getPayload();
		ipv4Dst = ipv4.getDestinationAddress();
	} else if (eth.getPayload() instanceof IPv6) {
		IPv6 ipv6 = (IPv6) eth.getPayload();
		ipv6Dst = ipv6.getDestinationAddress();
	}
	
	return new Entity(dlAddr,
			vlan,
			ipv4Dst,
			ipv6Dst,
			DatapathId.NONE,
			OFPort.ZERO,
			Entity.NO_DATE);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:35,代码来源:DeviceManagerImpl.java

示例6: learnDeviceFromArpResponseData

import org.projectfloodlight.openflow.types.MacAddress; //导入方法依赖的package包/类
/**
 * Learn device from ARP data in scenarios where the
 * Ethernet source MAC is different from the sender hardware
 * address in ARP data.
 */
protected void learnDeviceFromArpResponseData(Ethernet eth,
		DatapathId swdpid,
		OFPort port) {

	if (!(eth.getPayload() instanceof ARP)) return;
	ARP arp = (ARP) eth.getPayload();

	MacAddress dlAddr = eth.getSourceMACAddress();

	MacAddress senderAddr = MacAddress.of(arp.getSenderHardwareAddress());

	if (dlAddr.equals(senderAddr)) return; // arp request

	// Ignore broadcast/multicast source
	if (senderAddr.isBroadcast() || senderAddr.isMulticast())
		return;
	// Ignore zero sender mac
	if (senderAddr.getLong() == 0)
		return;

	VlanVid vlan = VlanVid.ofVlan(eth.getVlanID());
	IPv4Address nwSrc = IPv4Address.of(arp.getSenderProtocolAddress());

	Entity e =  new Entity(senderAddr,
			((vlan.getVlan() >= 0) ? vlan : null),
			((nwSrc.getInt() != 0) ? nwSrc : null),
			swdpid,
			port,
			new Date());

	learnDeviceByEntity(e);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:38,代码来源:DeviceManagerImpl.java


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