Exemple #1
0
 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;
 }
Exemple #2
0
 /* 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;
 }