Marc Lehmann wrote:
Hello,

that worked for me.

But i've got another question concerning the uip_datalen() function.

In my UIP_APPCALL function I try to check how much data has arrived with
the latest packet. I tried the uip_datalen() function, but it says 0 no
matter what kind of packet arrived.

Strange! uip_datalen() (which is #defined to be the uip_len variable) is supposed to be used for exactly that purpose.

I already checked your uip_process() function, but i cannot see where you
set uip_len to the data size. The only thing i saw is, that you reset the
length variables to 0.

uip_len is set to the size of the incoming packet (including headers) in the device driver. The uip_process() function later sets uip_len to the size of the incoming TCP data on lines 857 and 858 in uip.c:

  if((BUF->len[0] << 8) + BUF->len[1] <= uip_len) {
    uip_len = (BUF->len[0] << 8) + BUF->len[1];

Am I doing anything wrong?

Does your device driver correctly set uip_len?

Regards,

/adam

Thanks in advance
Marc


You can use a union, something like this:

typedef union {
   struct app1_state a1;
   struct app2_state a2;
   struct app3_state a3;
} uip_tcp_appstate_t;

and access the state structures through appstate->a1.var1; and so forth.
This way no extra memory is required.

Hope this helps,

/adam


--
Adam Dunkels, Swedish Institute of Computer Science
http://www.sics.se/~adam/

Reply via email to