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


Java U8类代码示例

本文整理汇总了Java中org.openflow.util.U8的典型用法代码示例。如果您正苦于以下问题:Java U8类的具体用法?Java U8怎么用?Java U8使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: asString

import org.openflow.util.U8; //导入依赖的package包/类
/**
 * Convert a string of bytes to a hex string
 *
 * @param bytes
 * @return "0fcafedeadbeef"
 */
public static String asString(byte[] bytes) {
    int i;
    String ret = "";
    String tmp;
    for (i = 0; i < bytes.length; i++) {
        if (i > 0) {
            ret += "";
        }
        tmp = Integer.toHexString(U8.f(bytes[i]));
        if (tmp.length() == 1) {
            ret += "0";
        }
        ret += tmp;
    }
    return ret;
}
 
开发者ID:lsinfo3,项目名称:ofcprobe,代码行数:23,代码来源:Util.java

示例2: decrementTtl

import org.openflow.util.U8; //导入依赖的package包/类
/**
 * Decrement the TTL of an IP packet. If the ethernet packet is an IPv4
 * packet decrement the TTL by n. Will return false if the TTL expired.
 * If the ethernet is not IPv4 will return true and not leave the packet
 * unchanged
 * @param eth Ethernet packet. 
 * @param n
 * @return false if the TTL expired, true otherwise
 */
protected boolean decrementTtl(Ethernet eth, int n) {
    if (eth.getPayload() instanceof IPv4) {
        IPv4 ipPkt = (IPv4)eth.getPayload();
        short ttl = U8.f(ipPkt.getTtl());
        if (n > 255)
            n = 255;
        short newTtl = (short) (ttl - (short)n);
        if (ttl <= n) {
            ipPkt.setTtl((byte)0);
            ipPkt.resetChecksum();
            return false;
        }
        ipPkt.setTtl(U8.t(newTtl));
        ipPkt.resetChecksum();
        return true;
    }
    return true;
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:28,代码来源:Forwarding.java

示例3: toString

import org.openflow.util.U8; //导入依赖的package包/类
/**
 * Returns a summary of the message
 * @return "ofmsg=v=$version;t=$type:l=$len:xid=$xid"
 */
@Override
public String toString() {
    return "ofmsg" +
        ":v=" + U8.f(this.getVersion()) +
        ";t=" + this.getType() +
        ";l=" + this.getLengthU() +
        ";x=" + U32.f(this.getXid());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:13,代码来源:OFMessage.java

示例4: toStringUnmasked

import org.openflow.util.U8; //导入依赖的package包/类
/**
 * Return a string including all match fields, regardless whether they
 * are wildcarded or not.
 */
public String toStringUnmasked() {
    String str = "";

    // l1
    str += STR_IN_PORT + "=" + U16.f(this.inputPort);

    // l2
    str += "," + STR_DL_DST + "="
            + HexString.toHexString(this.dataLayerDestination);
    str += "," + STR_DL_SRC + "="
            + HexString.toHexString(this.dataLayerSource);
    str += "," + STR_DL_TYPE + "=0x"
            + Integer.toHexString(U16.f(this.dataLayerType));
    str += "," + STR_DL_VLAN + "=0x"
            + Integer.toHexString(U16.f(this.dataLayerVirtualLan));
    str += "," + STR_DL_VLAN_PCP + "="
            + Integer.toHexString(U8.f(this.dataLayerVirtualLanPriorityCodePoint));

    // l3
    str += "," + STR_NW_DST + "="
            + cidrToString(networkDestination,
                           getNetworkDestinationMaskLen());
    str += "," + STR_NW_SRC + "="
            + cidrToString(networkSource,
                           getNetworkSourceMaskLen());
    str += "," + STR_NW_PROTO + "=" + this.networkProtocol;
    str += "," + STR_NW_TOS + "=" + this.getNetworkTypeOfService();

    // l4
    str += "," + STR_TP_DST + "=" + this.transportDestination;
    str += "," + STR_TP_SRC + "=" + this.transportSource;

    // wildcards
    str += ", wildcards=" + debugWildCards(wildcards);
    return "OFMatch[" + str + "]";
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:41,代码来源:OFMatch.java

示例5: readFrom

import org.openflow.util.U8; //导入依赖的package包/类
@Override
public void readFrom(ChannelBuffer data) {
    super.readFrom(data);
    this.bufferId = data.readInt();
    this.totalLength = data.readShort();
    this.inPort = data.readShort();
    this.reason = OFPacketInReason.values()[U8.f(data.readByte())];
    data.readByte(); // pad
    this.packetData = new byte[getLengthU() - MINIMUM_LENGTH];
    data.readBytes(this.packetData);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:12,代码来源:OFPacketIn.java

示例6: toString

import org.openflow.util.U8; //导入依赖的package包/类
/**
 * Returns a summary of the message
 * @return "ofmsg=v=$version;t=$type:l=$len:xid=$xid"
 */
public String toString() {
    return "ofmsg" +
        ":v=" + U8.f(this.getVersion()) +
        ";t=" + this.getType() +
        ";l=" + this.getLengthU() +
        ";x=" + U32.f(this.getXid());
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:12,代码来源:OFMessage.java

示例7: toString

import org.openflow.util.U8; //导入依赖的package包/类
/**
 * Returns a summary of the message
 *
 * @return "ofmsg=v=$version;t=$type:l=$len:xid=$xid"
 */
@Override
public String toString() {
    return "ofmsg" + ":v=" + U8.f(this.getVersion()) + ";t="
            + this.getType() + ";l=" + this.getLengthU() + ";x="
            + U32.f(this.getXid());
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:12,代码来源:OFMessage.java

示例8: readFrom

import org.openflow.util.U8; //导入依赖的package包/类
@Override
public void readFrom(final ChannelBuffer data) {
    super.readFrom(data);
    this.bufferId = data.readInt();
    this.totalLength = data.readShort();
    this.inPort = data.readShort();
    this.reason = OFPacketInReason.values()[U8.f(data.readByte())];
    data.readByte(); // pad
    this.packetData = new byte[this.getLengthU()
            - OFPacketIn.MINIMUM_LENGTH];
    data.readBytes(this.packetData);
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:13,代码来源:OFPacketIn.java

示例9: tryRevert

import org.openflow.util.U8; //导入依赖的package包/类
/**
 * Attempts to switch this route back to the original path.
 *
 * @param plink physical link that was restored
 * @return true for success, false otherwise
 */
public boolean tryRevert(PhysicalLink plink) {
    Iterator<Byte> it = this.unusableRoutes.descendingKeySet().iterator();
    while (it.hasNext()) {
        Byte curPriority = it.next();
        if (this.unusableRoutes.get(curPriority).contains(plink)) {
            log.info(
                    "Reactivate all inactive paths for virtual network {} big-switch {}"
                    + "internal route {} between ports ({},{}) in virtual network {} ",
                    this.getTenantId(), this.getSrcPort().getParentSwitch()
                            .getSwitchName(), this.routeId, this
                            .getSrcPort().getPortNumber(), this
                            .getDstPort().getPortNumber(), this
                            .getTenantId());

            if (U8.f(this.getPriority()) >= U8.f(curPriority)) {
                this.backupRoutes.put(curPriority,
                        this.unusableRoutes.get(curPriority));
            } else {

                try {
                    List<PhysicalLink> backupLinks = new ArrayList<>(OVXMap
                            .getInstance().getRoute(this));
                    Collections.copy(backupLinks, OVXMap.getInstance()
                            .getRoute(this));
                    this.backupRoutes.put(this.getPriority(), backupLinks);
                    this.switchPath(this.unusableRoutes.get(curPriority),
                            curPriority);
                } catch (LinkMappingException e) {
                    log.warn(
                            "No physical Links mapped to SwitchRoute? : {}",
                            e);
                    return false;
                }
            }
            it.remove();
        }
    }
    return true;
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:46,代码来源:SwitchRoute.java

示例10: readFrom

import org.openflow.util.U8; //导入依赖的package包/类
@Override
public void readFrom(ByteBuffer data) {
    super.readFrom(data);
    this.bufferId = data.getInt();
    this.totalLength = data.getShort();
    this.inPort = data.getShort();
    this.reason = OFPacketInReason.values()[U8.f(data.get())];
    data.get(); // pad
    this.packetData = new byte[getLengthU() - MINIMUM_LENGTH];
    data.get(this.packetData);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:12,代码来源:OFPacketIn.java


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