200 likes | 228 Views
BSD Networking Overview. Chuck Davin UPenn CSE 350 5 April 2001. Application Layer. Presentation Layer. Session Layer. Transport Layer. Network Layer. Data Link Layer. Physical Layer. OSI Reference Model. Application. Application. Unix Network Implementation. System Call Interface.
E N D
BSD Networking Overview Chuck Davin UPenn CSE 350 5 April 2001
Application Layer Presentation Layer Session Layer Transport Layer Network Layer Data Link Layer Physical Layer OSI Reference Model
Application Application Unix Network Implementation System Call Interface Sockets Protocols Abstract Network Interface Devices
Application Application Application Layer Presentation Layer Session Layer System Call Interface Sockets Transport Layer Protocols Network Layer Abstract Network Interface Data Link Layer Devices Physical Layer Model vs. Implementation
Application Layer Presentation Layer Session Layer Transport Layer Network Layer Data Link Layer Physical Layer OSI Reference ModelPossible Points of Multiplexing
Application Application Unix Network ImplementationPossible Points of Multiplexing System Call Interface Sockets Protocols Abstract Network Interface Devices
Socket Layer Functions • Support Network Functions in a Time-Shared Environment • Synchronize protocol indications (e.g., data delivery) with individual application • Synchronize individual application requests (e.g., data transmission) with underlying protocol • Protocol-independent interface to kernel networking functions
Copying! Socket Layer Service Interface • Unix System Call Interface (SCI) • Frequently requires data copying
Application Application Socket Layer Data Structures System Call Interface Per- Process File Descriptor Table Global File List Socket Structure File Descriptor To Protocol- Specific State (if any) Protocols Abstract Network Interface Devices
Socket Data Structure • Application Send Queue • Application Receive Queue • Protocol-Independent State Flags • E.g., generic connection state, delivery methods, selection state • Protocol-Independent Socket Options • Reference to Protocol-Specific State and Functions
Protocol Layer Functions • Protocol-Specific Functions • UDP • TCP • IP
Protocol Layer Service Interface • XXX_usrreq (so, cmd, …) • XXX_input (data, …) • XXX_ctlinput (data, …) • XXX_ctloutput (so, cmd, …) • XXX_init ()
Protocol User Requests • PRU_ATTACH • PRU_DETACH • PRU_SEND • PRU_RECV • PRU_BIND • PRU_CONNECT • PRU_SHUTDOWN • And so forth
Application Application Generic Protocol Data Structures System Call Interface Sockets To Protocol- Specific State (if any) Protocol Control Block (PCB) Protocol-Specific Links Abstract Network Interface Devices
Application Application UDP Data Structures System Call Interface Sockets To Protocol- Specific State (if any) In_pcb Structure In_pcb Structure … UDP PCB Chain Abstract Network Interface Devices
Internet PCB Data Structure • Local Host IP Address • Local Host Transport Port • Remote Host IP Address • Remote Host Transport Port • PCB Chain Linkage (viz. inpcb_lookup ()) • Reference to Parent Socket • Linkage to Private Protocol State
Application Application TCP Data Structures System Call Interface Sockets To Protocol- Specific State (if any) … In_pcb Structure In_pcb Structure TCP PCB Chain Tcpcb Structure Tcpcb Structure Abstract Network Interface Devices
TCP PCB Data Structure • Connection status • Send and Receive Windows • Send and Receive Sequence Numbers • TCP Urgent Data State • Maximum Segment Size • TCP Socket Options • Reference to Parent
Questions to Ponder • Would the BSD networking implementation benefit from a more object-oriented design? • Would a UDP socket be better implemented as a subclass of a generic socket with inherited methods? • What about TCP? • What are the advantages of the current approach? Don’t try this at home!