how to start rohc
i want to implement rohc in my voip network. iive installed rohc 1.2, libnet and libpcap but not understanding how to proceed forward. Please help.
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
|
#1 |
Hi monali,
ROHC is a library not a program. You have to develop your own program that uses the ROHC library to compress/decompress VoIP packets on your network. None is available at the moment.
In the source code of the library, there is an small tunnel program to help you starting your own program. The tunnel application compresses packets captured on a computer and encapsulates them in an UDP stream to transmit them toward another computer. This not what you want to do, but it may help you doing your job. Be careful that the tunnel application is dedicated to tests, it is not recommended for production use.
Some links you might find interesting :
- See https:/
- See https:/
- See this message on the mailing list (https:/
- See http://
Regards,
Didier Barvaux
Viveris Technologies
http://
Revision history for this message
|
#2 |
You can test the library with given example(pacp fomat file),and you need to set the main function's input
Revision history for this message
|
#3 |
I have followed some of the FAQ specially "638" for a sample program to integrate RoHC. Snapshot of the code is given below, Now I want to hook into some of the variable i.e
ip_packet \\ Initial IP Packet
rohc_packet \\ Compressed Packet
ip_packet_rx \\ Received Packet after decompression.
I want to capture these packets in dump them into pcap for analysis, how and where I should change my code.
2ndly, if I replace the following IPv4 header with IPv6 header program should work, or do I have change compression/
With Kind Regards,
Shaan
-------
/* system includes */
#include <stdlib.h>
#include <stdio.h>
/* includes to create a fake IP packet */
#include <netinet/ip.h>
#include <string.h>
/* includes for using ROHC library */
#include <rohc.h>
#include <rohc_comp.h>
#include <rohc_decomp.h>
/** The size (in bytes) of the buffers used in the program */
#define BUFFER_SIZE 2048
#define MAX_SIZE 2048
/** The payload for the fake IP packet */
#define FAKE_PAYLOAD "hello, ROHC world!"
/**
* @brief The main entry point for the simple ROHC program
*
* @param argc the number of arguments given to the program
* on command line
* @param argv the table of arguments given to the program
* on command line
* @return 0 in case of success, 1 otherwise
*/
int main(int argc, char **argv)
{
struct rohc_comp *compressor; /* the ROHC compressor */
struct rohc_decomp *decompressor; /* the ROHC decompressor */
unsigned char ip_packet[
unsigned int ip_packet_len; /* the length (in bytes) of the
struct iphdr *ip_header; /* the header of the IPv4 packet */
unsigned char rohc_packet[
int rohc_packet_len; /* the length (in bytes) of the
unsigned int i;
//decomp
//unsigned char packet[MAX_SIZE];
// unsigned int rohc_len;
unsigned char ip_packet_
int ip_size;
/* At program start-up, initialize the pre-computed tables for the 3-bit,
* 7-bit and 8-bit CRCs that the ROHC library will use.
*
* Note that the crc_table_3, crc_table_7 and crc_table_8 variables are
* declared inside the library, there is no need to declare them in your
* source code.
*/
crc_init_
crc_init_
crc_init_
/* create a ROHC compressor with small CIDs, no jamming and no adaptation
to encapsulation frames */
compressor = rohc_alloc_
if(compressor == NULL)
{
fprintf(
goto error;
}
/* create a ROHC compressor with small CIDs, no jamming and no adaptation
to encapsulation frames */
decompressor = rohc_alloc_
if(decompressor == NULL)
{
fprintf(
goto error;
}
/* enable the compression profiles you need (comment or uncomment some lines) */
rohc_
rohc_
rohc_
//rohc_
rohc_
/* create a fake IP packet for the purpose of this simple program */
ip_header = (struct iphdr *) ip_packet;
ip_header-
ip_header->ihl = 5; /* minimal IPv4 header length (in 32-bit words) */
ip_header->tos = 0;
ip_packet_len = ip_header->ihl * 4 + strlen(
ip_header-
ip_header->id = 0;
ip_header-
ip_header->ttl = 1;
ip_header-
ip_header->check = 0; /* set to 0 for checksum computation */
ip_header->saddr = htonl(0x01020304);
ip_header->daddr = htonl(0x05060708);
/* header is now built, compute the checksum */
ip_header->check = ip_fast_
/* copy the payload just after the IP header */
memcpy(ip_packet + ip_header->ihl * 4, FAKE_PAYLOAD, strlen(
/* dump the IP packet on terminal */
for(i = 0; i < ip_packet_len; i++)
{
printf("0x%02x ", ip_packet[i]);
if(i != 0 && ((i + 1) % 8) == 0)
{
printf("\n");
}
}
if(i != 0 && ((i + 1) % 8) != 0) /* be sure to go to the line */
{
printf("\n");
}
/* now, compress this fake IP packet */
rohc_packet_len = rohc_compress(
if(rohc_
{
fprintf(
goto release_compressor;
}
/* dump the ROHC packet on terminal */
for(i = 0; i < ((unsigned int) rohc_packet_len); i++)
{
printf("0x%02x ", rohc_packet[i]);
if(i != 0 && ((i + 1) % 8) == 0)
{
printf("\n");
}
}
if(i != 0 && ((i + 1) % 8) != 0) /* be sure to go to the line */
{
printf("\n");
}
/* release the ROHC compressor when you do not need it anymore */
rohc_
printf("the program ended successfully\n");
return 0;
release_compressor:
rohc_
error:
fprintf(stderr, "an error occured during program execution, "
//-----
/* read the ROHC packet somewhere, store it in the buffer named 'packet'
and set its length in the 'packet_len' variable */
ip_size = rohc_decompress
if(ip_size <= 0)
{
if(ip_size == ROHC_FEEDBACK_ONLY)
{
// the ROHC packet contained feedback only, so there is no
// decompressed IP data
// manage this special case here, do not treat it as an error
}
else
{
// manage the error here
}
}
rohc_free_
//-----
return 1;
}
Revision history for this message
|
#4 |
> I want to capture these packets in dump them into pcap for analysis,
> how and where I should change my code.
Look at the non-regression tool in the test/non_
See http://
> 2ndly, if I replace the following IPv4 header with IPv6 header program
> should work, or do I have change compression/
It should work. There is nothing to change.
Regards,
Didier
Revision history for this message
|
#5 |
Thank you, its a great help
On Fri, Jul 22, 2011 at 5:31 PM, Didier Barvaux <
<email address hidden>> wrote:
> Question #89639 on rohc changed:
> https:/
>
> Didier Barvaux proposed the following answer:
> > I want to capture these packets in dump them into pcap for analysis,
> > how and where I should change my code.
>
> Look at the non-regression tool in the test/non_
> good example.
> See
> http://
>
> > 2ndly, if I replace the following IPv4 header with IPv6 header program
> > should work, or do I have change compression/
> libraries/
>
> It should work. There is nothing to change.
>
> Regards,
> Didier
>
> --
> You received this question notification because you are a member of ROHC
> Team, which is an answer contact for rohc.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Can you help with this problem?
Provide an answer of your own, or ask monali for more information if necessary.