469,923 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

Calculating CheckSum for Raw UDP packet

I'm trying to calculate the checksum for UDP packet. The algorithm itself
is not difficult (lots of examples out there), but what I'm having the most
trouble with is determining the byte order that multibyte values need to be
in. The RFC's for the IP header and UDP protocol do not specify whether the
multibyte values need to be stored in host or network byte order.

Also, the verbage of the description for constructing the pseudoheader used
to calculate the UDP checksum is a bit confusing.

First the IP header. Do "length" and "header checksum" need to be stored in
the IP header in network or host order?

Second, the pseudo UDP header for calculating checksum as specified by RFC
768 (http://www.faqs.org/rfcs/rfc768.html). The way I interpret this is to
take the specified fields from the IP header, to construct a pseudo header.
Then, attach the UDP packet (source and dest port, size, checksum and data)
to the end of this pseudo header and use this entire block to calculate the
checksum. But, one of the fields in the pseudo header is "UDP length". Is
this length the same as the length used in the IP header or the length of
the "pseudo header" and UDP header and data?

After checksums are calculated, are they supposed to be stored in network or
host byte order?

Thanks,
Terry
Nov 15 '05 #1
1 11595
Nevermind. I got this figured out. "C# Network Programming" by Richard
Blum is an awesome book! I love it. :-)
"Terry" <ch**********@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP09.phx.gbl...
I'm trying to calculate the checksum for UDP packet. The algorithm itself
is not difficult (lots of examples out there), but what I'm having the most trouble with is determining the byte order that multibyte values need to be in. The RFC's for the IP header and UDP protocol do not specify whether the multibyte values need to be stored in host or network byte order.

Also, the verbage of the description for constructing the pseudoheader used to calculate the UDP checksum is a bit confusing.

First the IP header. Do "length" and "header checksum" need to be stored in the IP header in network or host order?

Second, the pseudo UDP header for calculating checksum as specified by RFC
768 (http://www.faqs.org/rfcs/rfc768.html). The way I interpret this is to take the specified fields from the IP header, to construct a pseudo header. Then, attach the UDP packet (source and dest port, size, checksum and data) to the end of this pseudo header and use this entire block to calculate the checksum. But, one of the fields in the pseudo header is "UDP length". Is this length the same as the length used in the IP header or the length of
the "pseudo header" and UDP header and data?

After checksums are calculated, are they supposed to be stored in network or host byte order?

Thanks,
Terry

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Astroman | last post: by
15 posts views Thread by ValK | last post: by
3 posts views Thread by Protoman | last post: by
2 posts views Thread by rdherric | last post: by
5 posts views Thread by =?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?= | last post: by
3 posts views Thread by Adriano | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.