This might sound dumb but how do each layer get the information? To give a context,
- Lets say I enter www.google.com, the browser sends a request to the Application layer and then the HTTPs request is formed which is our data.
- It is then passed onto the transport layer(Im skipping Session and presentation). Here, TCP is used and it adds the source port and destination port. How does the Transport layer get the information about the ports? Does the Application layer send that to the transport layer? When I say transport layer, I am referring to the OS which does the job.
- Because if it does, I haven't seen the HTTP GET request add that info.
- Similarly, how does the Network Layer get the source and destination IP? Is all the information there in the application layer data? Or is there a header that I am not aware of that the Application layer sends to the Transport layer which has Source port, Destination port, Source IP and Destination IP?
- Then finally, how does DataLink Layer get to know about the Source and Destination MAC?
- Each layer ought to be getting the info from somewhere to attach the header correct? How does it get the info?
I know it might sound very basic, but I dont have proper answers to these questions.