예제 #1
0
파일: ArpPacket.java 프로젝트: sjroot/lab
 /* copy constructor */
 public static ArpPacket copyArpPacket(ArpPacket arp) {
   ArpPacket p = new ArpPacket();
   p.hardwareType = 0x0001;
   p.protocolType = 0x0800;
   p.hardwareSize = 6;
   p.protocolSize = 4;
   p.opcode = arp.getOpcode();
   p.senderMac = arp.getSenderMac();
   p.senderIp = arp.getSenderIp();
   p.targetMac = arp.getTargetMac();
   p.targetIp = arp.getTargetIp();
   return p;
 }
예제 #2
0
파일: ArpPacket.java 프로젝트: sjroot/lab
 public static ArpPacket createReply(
     MacAddress senderMac, InetAddress senderIp, MacAddress targetMac, InetAddress targetIp) {
   ArpPacket p = new ArpPacket();
   p.hardwareType = 0x0001;
   p.protocolType = 0x0800;
   p.hardwareSize = 6;
   p.protocolSize = 4;
   p.opcode = 2;
   p.senderMac = senderMac;
   p.senderIp = senderIp;
   p.targetMac = targetMac;
   p.targetIp = targetIp;
   return p;
 }