Home | History | Annotate | Download | only in net

Lines Matching defs:packet

54     //   out = "        ByteBuffer packet = ByteBuffer.wrap(new byte[] {\n            "
65 // packet = (scapy.IPv6(src="2001:db8::1", dst="2001:db8::2") /
68 // print JavaPacketDefinition(str(packet))
72 // packet = (scapy.IPv6(src="2001:db8::1", dst="2001:db8::2", tc=0x80) /
77 ByteBuffer packet = ByteBuffer.wrap(new byte[] {
98 // Check that a valid packet has checksum 0.
99 int transportLen = packet.limit() - IPV6_HEADER_LENGTH;
100 assertEquals(0, IpUtils.tcpChecksum(packet, 0, IPV6_HEADER_LENGTH, transportLen));
104 int sum = getUnsignedByte(packet, sumOffset) * 256 + getUnsignedByte(packet, sumOffset + 1);
107 packet.put(sumOffset, (byte) 0);
108 packet.put(sumOffset + 1, (byte) 0);
109 assertChecksumEquals(sum, IpUtils.tcpChecksum(packet, 0, IPV6_HEADER_LENGTH, transportLen));
111 // Check that writing the checksum back into the packet results in a valid packet.
112 packet.putShort(
114 IpUtils.tcpChecksum(packet, 0, IPV6_HEADER_LENGTH, transportLen));
115 assertEquals(0, IpUtils.tcpChecksum(packet, 0, IPV6_HEADER_LENGTH, transportLen));
120 // packet = (scapy.IP(src="192.0.2.1", dst="192.0.2.2", tos=0x40) /
123 ByteBuffer packet = ByteBuffer.wrap(new byte[] {
134 // Check that a valid packet has IP checksum 0 and UDP checksum 0xffff (0 is not a valid
136 assertEquals(0, IpUtils.ipChecksum(packet, 0));
137 assertEquals((short) 0xffff, IpUtils.udpChecksum(packet, 0, IPV4_HEADER_LENGTH));
141 final int ipSum = getChecksum(packet, ipSumOffset);
144 packet.put(ipSumOffset, (byte) 0);
145 packet.put(ipSumOffset + 1, (byte) 0);
146 assertChecksumEquals(ipSum, IpUtils.ipChecksum(packet, 0));
149 final int udpSum = getChecksum(packet, udpSumOffset);
152 packet.put(udpSumOffset, (byte) 0);
153 packet.put(udpSumOffset + 1, (byte) 0);
154 assertChecksumEquals(udpSum, IpUtils.udpChecksum(packet, 0, IPV4_HEADER_LENGTH));
156 // Check that writing the checksums back into the packet results in a valid packet.
157 packet.putShort(ipSumOffset, IpUtils.ipChecksum(packet, 0));
158 packet.putShort(udpSumOffset, IpUtils.udpChecksum(packet, 0, IPV4_HEADER_LENGTH));
159 assertEquals(0, IpUtils.ipChecksum(packet, 0));
160 assertEquals((short) 0xffff, IpUtils.udpChecksum(packet, 0, IPV4_HEADER_LENGTH));