📄 macmetric.java
字号:
package com.ict.netcom2.metric;
import java.nio.ByteBuffer;
/**
* 15 * 24 = 360 bytes
* @author as
*
*/
public class MacMetric {
public static final int length = 360;
public MetricUnit broadcast = new MetricUnit(); // MAC层广播
public MetricUnit multicast = new MetricUnit(); // MAC层多播
public MetricUnit unicast = new MetricUnit(); // MAC层单播
public MetricUnit ipv4 = new MetricUnit(); // IPv4协议流量(0x0800)
public MetricUnit ipv6 = new MetricUnit(); // ipv6协议流量(0x86dd)
public MetricUnit ipx = new MetricUnit(); // ipx协议流量(0x8137)
public MetricUnit arp = new MetricUnit(); // arp协议流量(0x0806)
public MetricUnit rarp = new MetricUnit(); // rarp(Reverse Address Resolution Protocol)协议流量(0x8035)
public MetricUnit pppoe = new MetricUnit(); // PPP Over Ethernet协议流量(0x8863,0x8864)
public MetricUnit e8021q = new MetricUnit(); // 802.1q(Ethernet Automatic Protection Switching)协议流量(0x8100)
public MetricUnit mpls = new MetricUnit(); // mpls(Multi-Protocol Label Switching)协议流量(0x8847(单播),0x8848(多播))
public MetricUnit atalk = new MetricUnit(); // Appletalk DDP协议流量(0x809b)
public MetricUnit aarp = new MetricUnit(); // AppleTalk Address Resolution Protocol协议流量(0x80f3)
public MetricUnit x25 = new MetricUnit(); // CCITT X.25协议流量(0x0805)
public MetricUnit unknow = new MetricUnit();
public void store(byte[] result) {
if (result.length != length) {
System.err.println("[MacMetric.store()] param len wrong.");
}
ByteBuffer buf = ByteBuffer.wrap(result);
byte[] b = new byte[MetricUnit.length];
buf.get(b);
broadcast.store(b); // MAC层广播
buf.get(b);
multicast.store(b); // MAC层多播
buf.get(b);
unicast.store(b); // MAC层单播
buf.get(b);
ipv4.store(b); // IPv4协议流量(0x0800)
buf.get(b);
ipv6.store(b); // ipv6协议流量(0x86dd)
buf.get(b);
ipx.store(b); // ipx协议流量(0x8137)
buf.get(b);
arp.store(b); // arp协议流量(0x0806)
buf.get(b);
rarp.store(b); // rarp(Reverse Address Resolution Protocol)协议流量(0x8035)
buf.get(b);
pppoe.store(b); // PPP Over Ethernet协议流量(0x8863,0x8864)
buf.get(b);
e8021q.store(b); // 802.1q(Ethernet Automatic Protection Switching)协议流量(0x8100)
buf.get(b);
mpls.store(b); // mpls(Multi-Protocol Label Switching)协议流量(0x8847(单播),0x8848(多播))
buf.get(b);
atalk.store(b); // Appletalk DDP协议流量(0x809b)
buf.get(b);
aarp.store(b); // AppleTalk Address Resolution Protocol协议流量(0x80f3)
buf.get(b);
x25.store(b); // CCITT X.25协议流量(0x0805)
buf.get(b);
unknow.store(b);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -