Getting rohc_status = ROHC_STATUS_ERROR .

Asked by Jyotimay Saini

Dear Sir,
Hi, I'm developing a code for compretion. And it is returning rohc_status = ROHC_STATUS_ERROR , for the rohc_compress4(). Can't figure out what is the issue, I checked the buffer size, the input buffer before passing to the function the input buffer is not empty, and the rohc buffer is empty I don't know what is the issue with the code. The compression function is only working for profile 0x0000, For every other profile, it returns ROHC_STATUS_ERROR.

Regards,
Jyotirmay Saini

   **********************************************************************
  #define PAYLOAD "hello world"
      THIS IS INPUT PACKET
 // Create an IP packet for the purpose of this simple program
                      printf("\nBuild a fake IP packet.\n");
                      rohc_buf_byte_at(ip_packet, 0) = 4 << 4; // IP version 4
                      rohc_buf_byte_at(ip_packet, 0) |= 5; //IHL: min. IPv4 header length (in 32-bit words)
                      rohc_buf_byte_at(ip_packet, 1) = 0; // TOS
                      ip_packet.len = 5 * 4 + strlen(PAYLOAD);
                      rohc_buf_byte_at(ip_packet, 2) = (ip_packet.len >> 8) & 0xff; // Total Length
                      rohc_buf_byte_at(ip_packet, 3) = ip_packet.len & 0xff;
                      rohc_buf_byte_at(ip_packet, 4) = 0; // IP-ID
                      rohc_buf_byte_at(ip_packet, 5) = 0;
                      rohc_buf_byte_at(ip_packet, 6) = 0; // Fragment Offset and IP flags
                      rohc_buf_byte_at(ip_packet, 7) = 0;
                      rohc_buf_byte_at(ip_packet, 8) = 1; // TTL
                      rohc_buf_byte_at(ip_packet, 9) = 134; // Protocol: unassigned number
                      rohc_buf_byte_at(ip_packet, 10) = 0xa9; // IP Checksum
                      rohc_buf_byte_at(ip_packet, 11) = 0x3f;
                      rohc_buf_byte_at(ip_packet, 12) = 0x01; // Source address
                      rohc_buf_byte_at(ip_packet, 13) = 0x02;
                      rohc_buf_byte_at(ip_packet, 14) = 0x03;
                      rohc_buf_byte_at(ip_packet, 15) = 0x04;
                      rohc_buf_byte_at(ip_packet, 16) = 0x05; // Destination address
                      rohc_buf_byte_at(ip_packet, 17) = 0x06;
                      rohc_buf_byte_at(ip_packet, 18) = 0x07;
                      rohc_buf_byte_at(ip_packet, 19) = 0x08;

                     // Copy the payload just after the IP header
                     memcpy(rohc_buf_data_at(ip_packet, 5 * 4), PAYLOAD, strlen(PAYLOAD));
********************************************************************************************
                      HERE THE FUNCTION IS BEING USED
                        // Compress the IP packet.
                       printf("Compress the IP packet.\n");
                       rohc_status = rohc_compress4(compressor, ip_packet, &rohc_packet);
                       if(rohc_status != ROHC_STATUS_OK)
                       {
                        fprintf(stderr, "compression of IP packet failed: %s (%d)\n",
                        rohc_strerror(rohc_status), rohc_status);
                        // Cleanup compressor, then leave with an error code.
                        rohc_comp_free(compressor);
                        return 1;
                       }

Question information

Language:
English Edit question
Status:
Answered
For:
rohc Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Didier Barvaux (didier-barvaux) said :
#1

Hello,

> The compression function is only working for profile 0x0000, For every other profile, it returns ROHC_STATUS_ERROR.

This probably means that your packet is not a well-formed IP packet. It may be a problem with the IPv4 Total Length field or the IPv4 checksum for example.

Regards,
Didier

Can you help with this problem?

Provide an answer of your own, or ask Jyotimay Saini for more information if necessary.

To post a message you must log in.