← Back to team overview

rohc team mailing list archive

Re: [Question #670792]: Getting rohc_status = ROHC_STATUS_ERROR .

 

Question #670792 on rohc changed:
https://answers.launchpad.net/rohc/+question/670792

Description changed to:
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 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;
                       }

-- 
You received this question notification because your team ROHC Team is
an answer contact for rohc.