How would a tcp icmp look like?
Well to a length of cable, it looks like a series of electical voltage changes.
To a NIC, it's probably just an array of bytes.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Tcp and icmp are two different protocols.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Can you write own protocols in C?I am talking about the tcp and icmp headers.do i have to be root to do this on linux?
Last edited by invisibleghost; 08-01-2005 at 12:16 PM.
Yes. But if you want to write protocols in or below level 3 (network), it's operating system dependent. Otherwise, you can use sockets.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Could Make a tcp header but if i want to make my own tcp header i have to be in root.What you mean by socket's?I still a newbie at this.
TCP Header Format
TCP Header Format
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Port | Destination Port |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Acknowledgment Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Data | |U|A|P|R|S|F| |
| Offset| Reserved |R|C|S|S|Y|I| Window |
| | |G|K|H|T|N|N| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum | Urgent Pointer |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Options | Padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
TCP and ICMP headers have standard structures. Do you mean creating your own TCP header for the packet. ? If yes, then you will have to use RAW sockets to do that. To use RAW sockets in your program you have to be a superuser (like root on *nix systems).
Check this URL. It has good info on RAW sockets and how to construct TCP, UDP and ICMP headers.
Thanks,
So i take it i can do some socket in usr on linux that if i am right?
What do you mean by OS dependent? How could one create layer 2 packets?Originally Posted by Sang-drax
"I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe
http://www.Bloodware.net - Developing free software for the community.