Package org.hxzon.netprotocol.quick.packet

Source Code of org.hxzon.netprotocol.quick.packet.Ip4Packet

package org.hxzon.netprotocol.quick.packet;

import org.hxzon.netprotocol.quick.common.QPacketConstants;
import org.hxzon.netprotocol.quick.field.QProtocolStringField;
import org.hxzon.util.BytesUtil;

public class Ip4Packet extends QPacket {
    public static QProtocolStringField fetchProtocolCode(byte[] data, int headerOffset) {
        int fieldOffset = headerOffset + 9;
        int fieldLen = 1;
        String value = BytesUtil.toHexString(data, fieldOffset, fieldLen);
        QProtocolStringField field = new QProtocolStringField();
        field.init(fieldOffset, fieldLen, "protocol", "协议类型");
        field.setValue(value);
        return field;
    }

    public String defaultDesc() {
        return QPacketConstants.PacketTypeDesc_Ip4;
    }
}
TOP

Related Classes of org.hxzon.netprotocol.quick.packet.Ip4Packet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.