ethernetutils.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 30 行
JAVA
30 行
/*
* $Id: EthernetUtils.java,v 1.1 2003/11/25 11:52:25 epr Exp $
*/
package org.jnode.net.ethernet;
import org.jnode.driver.net.NetworkException;
/**
* @author epr
*/
public class EthernetUtils implements EthernetConstants {
/**
* Gets the procotol info from the ethernet frame in skbuf
* @param hdr
* @throws NetworkException The protocol cannot be found
*/
public static int getProtocol(EthernetHeader hdr)
throws NetworkException {
final int length = hdr.getLengthType();
if (length < ETH_FRAME_LEN) {
// It is a length field
return EthernetConstants.ETH_P_802_2;
} else {
// It is a protocol ID
return length;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?