udpmetric.java
来自「利用Java Socket写的一段通讯协议」· Java 代码 · 共 157 行
JAVA
157 行
package com.ict.netcom2.metric;
import java.nio.ByteBuffer;
/**
* 根据UDP的熟识端口所确定的应用的原始指标
* 26 * 24 = 624 bytes
*/
public class UDPMetric {
public static final int length = 624;
public MetricUnit dns = new MetricUnit(); // 53
public MetricUnit netbios = new MetricUnit(); // 137,138,139
public MetricUnit nfs = new MetricUnit(); // 2409
public MetricUnit snmp = new MetricUnit(); // 161 ,162
public MetricUnit tftp = new MetricUnit(); // 69, Trivial File Transfer ,1758(multicase)
public MetricUnit rip = new MetricUnit(); // 520
public MetricUnit ripng = new MetricUnit(); // 521
public MetricUnit mgcp = new MetricUnit(); // 2427-Gateway; 2727-call agent; Multimedia Gateway Control Protocl
public MetricUnit mobile_ip = new MetricUnit(); // 434; Mobile IP ,435
public MetricUnit bootp = new MetricUnit(); // 67 Bootstrap Protocol Server(dhcps); 68 Bootstrap Protocol Client dhcp
public MetricUnit ntp = new MetricUnit(); // 123; Network Time Protocol
public MetricUnit dhcpv6 = new MetricUnit(); // 547 ,546
public MetricUnit radius = new MetricUnit(); // 1646-obsolete; 1812-server; 1823-accounting, 3799-dynamic authorization.
public MetricUnit rtp = new MetricUnit(); // 5004;5005-RTP control Protocol; Real-Time Protocol
public MetricUnit irap = new MetricUnit(); // 38 ,Internet Route Access Protocol
public MetricUnit rlp = new MetricUnit(); // 39, Resource Location Protocol
public MetricUnit rtsp = new MetricUnit(); // 554
public MetricUnit ldp = new MetricUnit(); // 646
public MetricUnit wins = new MetricUnit(); // 1512
public MetricUnit mul_conf = new MetricUnit(); // 1347,1348
public MetricUnit etftp = new MetricUnit(); // 1818, Enhanced Trivial File Transfer Protocol
public MetricUnit megaco = new MetricUnit(); // 2944,2945
public MetricUnit icp = new MetricUnit(); // 3130, Internet Cache Protocol
public MetricUnit tftps = new MetricUnit(); // 3713
public MetricUnit sip = new MetricUnit(); // 5060,5061
public MetricUnit unknow = new MetricUnit();
public void store(byte[] result) {
if (result.length != length) {
System.err.println("[UDPMetric.store()] param len wrong.");
}
ByteBuffer buf = ByteBuffer.wrap(result);
byte[] b = new byte[MetricUnit.length];
buf.get(b);
dns.store(b); // 53
buf.get(b);
netbios.store(b); // 137,138,139
buf.get(b);
nfs.store(b); // 2409
buf.get(b);
snmp.store(b); // 161 ,162
buf.get(b);
tftp.store(b); // 69, Trivial File Transfer ,1758(multicase)
buf.get(b);
rip.store(b); // 520
buf.get(b);
ripng.store(b); // 521
buf.get(b);
mgcp.store(b); // 2427-Gateway; 2727-call agent; Multimedia Gateway Control Protocl
buf.get(b);
mobile_ip.store(b); // 434; Mobile IP ,435
buf.get(b);
bootp.store(b); // 67 Bootstrap Protocol Server(dhcps); 68 Bootstrap Protocol Client dhcp
buf.get(b);
ntp.store(b); // 123; Network Time Protocol
buf.get(b);
dhcpv6.store(b); // 547 ,546
buf.get(b);
radius.store(b); // 1646-obsolete; 1812-server; 1823-accounting, 3799-dynamic authorization.
buf.get(b);
rtp.store(b); // 5004;5005-RTP control Protocol; Real-Time Protocol
buf.get(b);
irap.store(b); // 38 ,Internet Route Access Protocol
buf.get(b);
rlp.store(b); // 39, Resource Location Protocol
buf.get(b);
rtsp.store(b); // 554
buf.get(b);
ldp.store(b); // 646
buf.get(b);
wins.store(b); // 1512
buf.get(b);
mul_conf.store(b); // 1347,1348
buf.get(b);
etftp.store(b); // 1818, Enhanced Trivial File Transfer Protocol
buf.get(b);
megaco.store(b); // 2944,2945
buf.get(b);
icp.store(b); // 3130, Internet Cache Protocol
buf.get(b);
tftps.store(b); // 3713
buf.get(b);
sip.store(b); // 5060,5061
buf.get(b);
unknow.store(b);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?