rohc team mailing list archive
-
rohc team
-
Mailing list archive
-
Message #00081
Re: decompressor not working for me
Hi,
> There was no attachment.
Sorry. Here it is.
Didier
> On Wed, 2009-11-25 at 10:35 +0100, Didier Barvaux wrote:
> > Hi,
> >
> > > The code I replaced it with is given below.
> > > /* read the IP-ID field */
> > > {
> > > uint16_t temp = 0;
> > > temp = packet[0];
> > > temp <<= 8;
> > > temp |= packet[1];
> > > //ipv4_set_id(ip, *((uint16_t *) packet));
> > > ipv4_set_id(ip, temp);
> > > rohc_debugf(3, "IP-ID = 0x%04x\n",
> > > ntohs(ipv4_get_id(*ip))); packet += 2;
> > > read += 2;
> > > }
> > > from below given function "d_decode_dynamic_ip4".
> >
> > Thank you. Could you please compile and run the attached test
> > program to check if the uint16_t cast is the root of your problem ?
> > You may follow these steps :
> > $ gcc -g -Wall -Werror -c -o test_uint16t_cast.o
> > test_uint16t_cast.c $ gcc test_uint16t_cast.o -o test_uint16t_cast
> > $ ./test_uint16t_cast
> > first 2 bytes = 0x0100
> > last 2 bytes = 0x0302
> >
> > Please report me any GCC warning. The result given by the test
> > program may differ from the one I get on x86 depending on the
> > endianness of your microcontroller.
> >
> >
> > > I have not used gdb yet on uclinux.
> > >
> > > can you send some instructions as you said?
> > > It will be helpful.
> >
> > I do not know how to install gdb on uclinux if it is not done yet.
> > Use the documentation provided by the manufacturer.
> >
> > Once gdb is setup on your platform, you may follow these
> > instructions : $ gdb ./test_program [optional_arguments]
> > (gdb) run
> > <gdb reports crash here>
> > (gdb) bt
> >
> > Do not forget to build you test program with "-g" so that debug
> > information is included in the binary.
> >
> > Didier Barvaux
> > Viveris Technologies
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~rohc
> > Post to : rohc@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~rohc
> > More help : https://help.launchpad.net/ListHelp
>
>
#include <stdio.h>
#include <stdint.h>
int main(int argc, char *argv[])
{
unsigned char data[] = "\x00\x01\x02\x03";
uint16_t value;
value = *((uint16_t *) data);
printf("first 2 bytes = 0x%04x\n", value);
value = *((uint16_t *) (data + 2));
printf("last 2 bytes = 0x%04x\n", value);
return 0;
}
Follow ups
References