Here we are going to show you a little introduction of how networking works in NachOS.
In Nachos we have two main classes:
The network class
The postoffice class
Network
The network class is not directly used by the user. It is the Link between nachOS and sockets TCP/IP.
It has four methods:
- Send: Sends a packet to a NachOS machine.
- Receive: If there is a packet, it receives it. If not, it returns with a 0.
- CheckPktAvail: It activates regularly to verify if a packet arrives.
- SendDone: When it receives the packet, it calls a manager in order to organize it.
For communication, NachOS uses PacketHeader and MailHeader.
They both contain:
To (Destination of the packet)
From (Origin of the packet)
Length (Size of the packet)
Postoffice
Example of postoffice
- Sends a packet to a given address
- Waits for a message and prints it once received
- Sends another packet to the same address
- Waits for a message and prints it once received
Now we are going to explain some other important files in the network folder and we are going to show you some code
- nettest.cc (nachos/code/network)
Here is where we run the routines of the network test.
- post.h, post.cc (nachos/code/network)
They help to synchronize the data sent and received. (like a messenger)
Here we show you some code
Post.h
Post.cc
- network.h, network.cc (nachos/code/machine)
They are a physical network hardware emulation.
Network.h
Network.cc
References:
bit.ly/vtlhRr
bit.ly/vtlhRr
Esto lo pongo como el +1 por contenido extra en el blog.
ResponderEliminar