I'm programming an offline packets decoding program in C under Windows 7 x86.
I wonder how it is possible to know packet protocol, either if it is UDP
or TCP
?
You can know by checking the IP packet header, there is a Protocol
field in the packet header that is used to indicate the type of the packet according to its value :
1
is ICMP6
is TCP17
is UDPand so on. More information on this is available on Wikipedia
Edit: Here's the list of all the possible values for that field.
P.S: I'm assuming IPv4 here, I don't know if things are the same with IPv6