Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- test_rohc.c.orig 2013-05-30 20:28:50.000000000 +0200
- +++ test_rohc.c 2013-05-30 20:41:26.000000000 +0200
- @@ -131,18 +131,16 @@
- ip_packet[0] |= 5; /* IHL: minimal IPv4 header length (in 32-bit words) */
- ip_packet[1] = 0; /* TOS */
- ip_packet_len = 56; //5 * 4 + strlen(FAKE_PAYLOAD);
- - ip_packet[2] = (htons(ip_packet_len) >> 8) & 0xff; /* Total Length */
- - ip_packet[3] = htons(ip_packet_len) & 0xff;
- - //ip_packet[2] = (ip_packet_len >> 8) & 0xff; /* Total Length */
- - //ip_packet[3] = ip_packet_len & 0xff;
- + ip_packet[2] = (ip_packet_len >> 8) & 0xff; /* Total Length */
- + ip_packet[3] = ip_packet_len & 0xff;
- ip_packet[4] = 0; /* IP-ID */
- ip_packet[5] = 0;
- ip_packet[6] = 0; /* Fragment Offset and IP flags */
- ip_packet[7] = 0;
- ip_packet[8] = 1; /* TTL */
- ip_packet[9] = 17; /* Protocol: unassigned number */
- - ip_packet[10] = 0xbe; /* fake Checksum */
- - ip_packet[11] = 0xef;
- + ip_packet[10] = 0xa9; /* fake Checksum */
- + ip_packet[11] = 0xa2;
- ip_packet[12] = 0x01; /* Source address */
- ip_packet[13] = 0x02;
- ip_packet[14] = 0x03;
- @@ -153,10 +151,10 @@
- ip_packet[19] = 0x08;
- /* fake UDP headers, 8 bytes */
- - udp_packet[0] = 0x05; /* Source address */
- - udp_packet[1] = 0x06;
- - udp_packet[2] = 0x05; /* Destination address */
- - udp_packet[3] = 0x06;
- + udp_packet[0] = 0x04; /* Source address */
- + udp_packet[1] = 0xd2;
- + udp_packet[2] = 0x04; /* Destination address */
- + udp_packet[3] = 0xd2;
- udp_packet_len = 36;
- udp_packet[4] = (udp_packet_len >> 8) & 0xff; /* Total Length */
- udp_packet[5] = udp_packet_len & 0xff;
- @@ -293,6 +291,7 @@
- if(decomp_size <= 0)
- {
- printf("\ndecompression of fake IP packet failed. decompressed size = %d\n", decomp_size);
- + goto release_decompressor;
- }
- else {
- printf("\nROHC packet resulting from the ROHC decompression:\n");
- @@ -324,9 +323,10 @@
- return 0;
- +release_decompressor:
- + rohc_free_decompressor(decompressor);
- release_compressor:
- rohc_free_compressor(compressor);
- - rohc_free_decompressor(decompressor);
- error:
- fprintf(stderr, "an error occured during program execution, "
- "abort program\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement