starting a TCP/IP stack ...
Posted: Mon Sep 01, 2003 1:37 am
i suggest you start with a UDP/IP ... TCP will come later :-pJC 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!!!
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
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/