Re: [lwip-users] Try to manipulate the pbuf payload

2017-09-01 Thread Sergio R. Caprile

Well...
You do know that p->payload is a void*, that is, a pointer to some 
bytes, do you ?

http://www.nongnu.org/lwip/2_0_x/structpbuf.html#a8d32dc3e964369d4eec638fc37fbc460

Then, why do you want to peek at data between your driver and lwip ? You 
are not using the RAW API, you are looking at raw frame payload contents 
before being passed on to lwIP. You either use UDP or TCP (unless you 
really need to use raw IP, but then you will not probably do what you 
are doing now, or raw frames, but I can't help you there)
Anyway, incoming pbufs are of type PBUF_RAM, that means they can 
actually a chain of pbufs, any action on them must be through the 
pbuf_...() functions:

http://www.nongnu.org/lwip/2_0_x/group__pbuf.html#ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21

You should see what the examples do and study them.
Also, there is a nice wiki covering whatever the official docs might not 
be verbose at, you could start by understanding the RAW API here:

http://lwip.wikia.com/wiki/Raw/native_API

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


[lwip-users] Try to manipulate the pbuf payload

2017-09-01 Thread User431
Hello,

I have got some issues in reading the payload of the pbuf. 
I'm using a STM32 microcontroller and run on it the LwIP Stack in the raw
API without a RTOS. 
It's based on a example from ST with a Webserver and is working fine. 

But now I want to read the payload, when a new packet is recieved. 
Whit printf I can send messages throug UART to a computer and see them with
a terminal programm. This works fine so far. 

My first try was just to printf the payload, with: printf("%d\n",
p->payload); 
I recieve messages, but they are wrong, just 10 characters long. And they
have always the same long. 
Then I tried to send the lenght of the packets with printf("%d\n", p->len);
This works fine, the length is the same as Wireshark is showing.

I implemented my code just beetween this line:
/* move received packet into a new pbuf */
  p = low_level_input(netif);

and this:
  /* entry point to the LwIP stack */
  err = netif->input(p, netif);

I also tried first to copy the payload with memcpy, but the result is the
same.

I also debbuged with SW4STM32, and this shows the same results. 

What am I doing wrong? 
Thank you very much. 



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users