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


Java EtherType.getInstance方法代码示例

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


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

示例1: buildPacket

import org.pcap4j.packet.namednumber.EtherType; //导入方法依赖的package包/类
/**
 *
 * @param builder
 */
public void buildPacket(AbstractPacket.AbstractBuilder builder) {

    if (!this.type.equals(EtherType.getInstance((short) 0x0000))) {
        // do nothing if type not 0x0000
    } else if (builder == null) {
        this.type = EtherType.getInstance((short) 0xFFFF);
    } else {
        this.type = EtherType.IPV4;
    }
    db = new Dot1qVlanTagPacket.Builder();
    db.priority(priority)
            .cfi(cfi)
            .vid(vid)
            .type(type)
            .payloadBuilder(builder);
    this.packet = db.build();
}
 
开发者ID:exalt-tech,项目名称:trex-stateless-gui,代码行数:22,代码来源:TrexVlanPacket.java

示例2: buildPacket

import org.pcap4j.packet.namednumber.EtherType; //导入方法依赖的package包/类
/**
 *
 * @param builder
 */
public void buildPacket(AbstractPacket.AbstractBuilder builder) {

    if (builder == null) {

        this.type = EtherType.getInstance((short) 0xFFFF);
    }

    ethernetBuilder = new EthernetPacket.Builder();
    ethernetBuilder.dstAddr(dstAddr)
            .srcAddr(srcAddr)
            .type(type)
            .payloadBuilder(builder);

    byte[] pad;
    if (builder == null || addPad) {

        if (payload != null) {
            String payloadString = payload.getPayloadType().getPadPayloadString(payload.getPayloadPattern(), 100000);
            pad = new BigInteger(payloadString, 16).toByteArray();
        } else {
            pad = new byte[0];
        }

        ethernetBuilder.paddingAtBuild(false).pad(pad);
        this.packet = ethernetBuilder.build();
        fixPacketLength();
    } else {
        ethernetBuilder.paddingAtBuild(true);
        this.packet = ethernetBuilder.build();
    }
}
 
开发者ID:exalt-tech,项目名称:trex-stateless-gui,代码行数:36,代码来源:TrexEthernetPacket.java

示例3: TrexVlanPacket

import org.pcap4j.packet.namednumber.EtherType; //导入方法依赖的package包/类
/**
 *
 */
public TrexVlanPacket() {
    this.priority = (byte) 0;
    this.cfi = false;
    this.vid = (short) 0;
    this.type = EtherType.getInstance((short) 0x0000);
}
 
开发者ID:exalt-tech,项目名称:trex-stateless-gui,代码行数:10,代码来源:TrexVlanPacket.java

示例4: setType

import org.pcap4j.packet.namednumber.EtherType; //导入方法依赖的package包/类
/**
 *
 * @param type
 */
public void setType(short type) {
    this.type = EtherType.getInstance(type);
}
 
开发者ID:exalt-tech,项目名称:trex-stateless-gui,代码行数:8,代码来源:TrexEthernetPacket.java


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