starting a TCP/IP stack ...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

starting a TCP/IP stack ...

Post by Pype.Clicker »

JC wrote: Do you have any suggestions on where do i start on establishing a TCP/IP stack for my PM OS???
links/resources etc etc are most welcome!!!
i suggest you start with a UDP/IP ... TCP will come later :-p

make sure:
  • you have memory management that allows you to allocate buffers for your network device driver
  • you have read all the Request For Comments documents related to your problem (googling for "RFC IP" or maybe "RFC Record Route" may help).
  • you have timers to implement timeouts for retransmissions (this is mainly TCP-related, but it will still be a good base, even just to send pings :)
maybe you can try the following 'milestones' sequence, inspirated by my knowledge of x-kernel (described in the book below) :
1. sending and receiving raw packets (ICMP echoes, for instance) that a program provides to the NIC driver (NIC.push(&Packet) and NIClistener.recv(&Packet))
2. receiving packets (from the OS) and create the IP header needed to send them through a given NIC to a given destination (NetworkLayer.push(&Packet, Address from, Address to))
3. receiving packets from the NIClistener.recv() interface, decode the IP header and decide whether it is for you or not based on NL.myIpAddress.
4. register some above-ip layers and have NetworkLayer forward the Packet to the NLlistenter.recv() function (based on the "protocol" field of IP packets. A good starting point would be to implement the ICMP protocol :p) -- then allow them to send packets back

Past this point, you'll probably need something like a "socket" abstraction to create OS objects that will keep some parameters like source/dest IP addresses or ports, sequence numbers etc.


reference books:
"Computer Networks -- a system approach" by Larry L. Peterson & Bruce S. Davie
"Architecture R?seau Linux // Linux NetzwerkArchitektuur" by K. Wehrle, F. P?hlke, H. Ritter, D. M?ller (fear his gorilla :p ) and M. Bechler
file:///usr/src/linux/Documentation/networking/
JC

Re:starting a TCP/IP stack ...

Post by JC »

Thanks a bunch!
shall put my brain to task and get back.
Post Reply