[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] What is pbuf's payload?
From: |
Pomeroy, Marty |
Subject: |
Re: [lwip-users] What is pbuf's payload? |
Date: |
Fri, 3 Aug 2012 13:22:46 -0400 |
Well, assuming "unsigned char * packet" is a pointer to your
received byte array:
if ( (*(short *)&packet[12]) == 0x0800 &&
packet[23] == 0x11) // 0x800 is IP packet, 0x11 is UDP protocol byte in IP
header
you have a UDP packet (verify those offsets are
correct). You can look at this before it gets passed in to
tcpip_input().
Was this what you were looking for?
Marty
Sorry, but I am answering my own question
again...
1) tcpip_input posts the message TCPIP_MSG_INPUT with pbuf,
along with its payload
2) tcpip_thread picks up the message and calls
ethernet_input because NETIF_FLAG_ETHARP was set in low_level_init during
ethernetif_init
3) ethernet_input
looks at pbuf's payload, which starts with Ethernet header, and based on the
type, it calls ip_input or others
I'd like to catch an UDP packet without parcing it all the way. If anyone
has any pointer, please suggest, thanks
Date: Thu, 02 Aug 2012 16:53:57
-0400
From: Chen <address@hidden>
To:
address@hidden
Subject: [lwip-users] What is pbuf's
payload?
Message-ID:
<address@hidden>
Content-Type: text/plain;
charset="us-ascii"; Format="flowed"
Hi there,
I am trying to
understand pbuf's payload referenced in
tcpip_input(struct pbuf *p, struct
netif *inp)
pbuf's payload is defined as void *, what are the possible
structures
it can be under tcpip_input()?
since tcpip_input deals
with udp and tcp only, is it just the actual
data from udp and tcp
packets?
thanks for any
pointer
Chen