TCP/IP Illustrated, Volume 2 The Implementation

by ;
Edition: 1st
Format: Hardcover
Pub. Date: 1995-01-31
Publisher(s): Addison-Wesley Professional
List Price: $84.99

Rent Textbook

Select for Price
There was a problem. Please try again later.

Digital

Rent Digital Options
Online:1825 Days access
Downloadable:Lifetime Access
$98.39
*To support the delivery of the digital material to you, a non-refundable digital delivery fee of $3.99 will be charged on each digital item.
$98.39*

New Textbook

We're Sorry
Sold Out

Used Textbook

We're Sorry
Sold Out

How Marketplace Works:

  • This item is offered by an independent seller and not shipped from our warehouse
  • Item details like edition and cover design may differ from our description; see seller's comments before ordering.
  • Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
  • Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
  • Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.

Summary

Bestselling author W. Richard Stevens teams up with Gary Wright for the second volume in the successful TCP/IP Illustrated series. This volume focuses on implementation issues. The authors use real working code--15,000 lines of code--together with pictures and descriptions of all data structures and algorithms to help the reader master the TCP/IP protocol suite.

Author Biography

Gary R. Wright has worked with TCP/IP for more than eight years. He is President of Connix, a Connecticut-based company providing Internet access and consulting services.

We are deeply saddened to learn of the death of noted author W. Richard Stevens. His passing is obviously a tremendous loss for the technical community, but it is a personal one for us as well. Rich was both a gifted colleague and a valued friend who will be greatly missed. We extend our sympathies to his family.

Obituary from the Arizona Daily Star:

STEVENS, W. Richard, noted author of computer books died on September 1. He is best known for his "UNIX Network Programming" series (1990, 1998, 1999), "Advanced Programming in the UNIX Environment" (1992), and "TCP/IP Illustrated" series (1994, 1995, 1996). Richard was born in 1951 in Luanshya, Northern Rhodesia (now Zambia), where his father worked for the copper industry. The family moved to Salt Lake City, Hurley, New Mexico, Washington, DC and Phalaborwa, South Africa. Richard attended Fishburne Military School in Waynesboro, Virginia. He received a B.SC. in Aerospace Engineering from the University of Michigan in 1973, and an M.S. (1978) and Ph.D. (1982) in Systems Engineering from the University of Arizona. He moved to Tucson in 1975 and from then until 1982 he was employed at Kitt Peak National Observatory as a computer programmer. From 1982 until 1990 he was Vice President of Computing Services at Health Systems International in New Haven, CT, moving back to Tucson in 1990. Here he pursued his career as an author and consultant. He was also an avid pilot and a part-time flight instructor during the 1970's.

He is survived by his loving wife of 20 years, Sally Hodges Stevens; three wonderful children, Bill, Ellen and David; sister, Claire Stevens of Las Vegas, NV; brother, Bob and wife Linda Stevens of Dallas, TX; nieces, Laura, Sarah, Collette, Christy; and nephew, Brad. He is predeceased by his parents, Royale J. Stevens (1915-1984); and Helen Patterson Stevens (1916-1997). Helen lived in Tucson from 1991-1997, and Royale lived here in the early 1930's attending Tucson High School while his father was treated for TB at the Desert Sanitorium (now TMC). The family asks that in lieu of flowers, donations be made in Richard's name to Habitat for Humanity, 2950 E. 22nd Street, Tucson, AZ 85713. A memorial service for Richard will be held at St. Phillip's in the Hills Episcopal Church on Tuesday, September 7th at 12:00 noon. Following the service there will be a reception in the Murphy Gallery of the Church. Please wear colorful clothing to the service; Richard loved colors.

W. Richard Stevens was an acknowledged UNIX and networking expert and the highly-respected author of several books. He was also a sought-after instructor and consultant.



020163354XAB04062001

Table of Contents

Preface xix
Introduction
1(30)
Introduction
1(1)
Source Code Presentation
1(2)
History
3(2)
Application Programming Interfaces
5(1)
Example Program
5(2)
System Calls and Library Functions
7(2)
Network Implementation Overview
9(1)
Descriptors
10(5)
Mbufs (Memory Buffers) and Output Processing
15(4)
Input Processing
19(3)
Network Implementation Overview Revisited
22(1)
Interrupt Levels and Concurrency
23(3)
Source Code Organization
26(2)
Test Network
28(1)
Summary
29(2)
Mbufs: Memory Buffers
31(32)
Introduction
31(5)
Code Introduction
36(1)
Mbuf Definitions
37(1)
mbuf Structure
38(2)
Simple Mbuf Macros and Functions
40(4)
m_devget and m_pullup Functions
44(7)
Summary of Mbuf Macros and Functions
51(3)
Summary of Net/3 Networking Data Structures
54(2)
m_copy and Cluster Reference Counts
56(4)
Alternatives
60(1)
Summary
60(3)
Interface Layer
63(32)
Introduction
63(1)
Code Introduction
64(1)
ifnet Structure
65(8)
ifaddr Structure
73(1)
sockaddr Structure
74(2)
ifnet and ifaddr Specialization
76(1)
Network Initalization Overview
77(3)
Ethernet Initialization
80(2)
SLIP Initialization
82(3)
Loopback Initialization
85(1)
if_attach Function
85(8)
ifinit Function
93(1)
Summary
94(1)
Interfaces: Ethernet
95(32)
Introduction
95(1)
Code Introduction
96(2)
Ethernet Interface
98(16)
ioctl System Call
114(11)
Summary
125(2)
Interfaces: SLIP and Loopback
127(28)
Introduction
127(1)
Code Introduction
127(1)
SLIP Interface
128(22)
Loopback Interface
150(3)
Summary
153(2)
IP Addressing
155(30)
Introduction
155(3)
Code Introduction
158(1)
Interface and Address Summary
158(2)
sockaddr_in Structure
160(1)
in_ifaddr Structure
161(1)
Address Assignment
161(16)
Interface ioctl Processing
177(4)
Internet Utility Functions
181(1)
ifnet Utility Functions
182(1)
Summary
183(2)
Domains and Protocols
185(20)
Introduction
185(1)
Code Introduction
186(1)
domain Structure
187(1)
protosw Structure
188(3)
IP domain and protosw Structures
191(5)
pffindproto and pffindtype Functions
196(2)
pfctlinput Function
198(1)
IP Initalization
199(2)
sysctl System Call
201(3)
Summary
204(1)
IP: Internet Protocol
205(42)
Introduction
205(1)
Code Introduction
206(4)
IP Packets
210(2)
Input Processing: ipintr Function
212(8)
Forwarding: ip_forward Function
220(8)
Output Processing: ip_output Function
228(6)
Internet Checksum: in_cksum Function
234(5)
setsockopt and getsockopt System Calls
239(5)
ip_sysctl Function
244(1)
Summary
245(2)
IP Option Processing
247(28)
Introduction
247(1)
Code Introduction
247(1)
Option Format
248(1)
ip_dooptions Function
249(3)
Record Route Option
252(2)
Source and Record Route Options
254(7)
Timestamp Option
261(4)
ip_insertoptions Function
265(4)
ip_pcopts Function
269(3)
Limitations
272(1)
Summary
272(3)
IP Fragmentation and Reassembly
275(26)
Introduction
275(2)
Code Introduction
277(1)
Fragmentation
278(4)
ip_opt copy Function
282(1)
Reassembly
283(3)
ip_reass Function
286(12)
ip_slowtimo Function
298(2)
Summary
300(1)
ICMP: Internet Control Message Protocol
301(36)
Introduction
301(4)
Code Introduction
305(3)
icmp Structure
308(1)
ICMP protosw Structure
309(1)
Input Processing: icmp_input Function
310(3)
Error Processing
313(3)
Request Processing
316(5)
Redirect Processing
321(2)
Reply Processing
323(1)
Output Processing
324(1)
icmp_error Function
324(4)
icmp_reflect Function
328(5)
icmp_send Function
333(1)
icmp_systcl Function
334(1)
Summary
335(2)
IP Multicasting
337(44)
Introduction
337(3)
Code Introduction
340(1)
Ethernet Multicast Addresses
341(1)
ether_multi Structure
342(2)
Ethernet Multicast Reception
344(1)
in_multi Structure
345(2)
ip_moptions Structure
347(1)
Multicast Socket Options
348(1)
Multicast TTL Values
348(3)
ip_setmoptions Function
351(4)
Joining and IP Multicast Group
355(11)
Leaving an IP Multicast Group
366(5)
ip_getmoptions Function
371(2)
Multicast Input Processing: ipintr Function
373(2)
Multicast Output Processing: ip_output Function
375(4)
Performance Considerations
379(1)
Summary
379(2)
IGMP: Internet Group Management Protocol
381(16)
Introduction
381(1)
Code Introduction
382(2)
igmp Structure
384(1)
IGMP protosw Structure
384(2)
Joining a Group: igmp_joingroup Function
386(1)
igmp_fasttimo Function
387(4)
Input Processing: igmp_input Function
391(4)
Leaving a Group: igmp_leavegroup Function
395(1)
Summary
396(1)
IP Multicast Routing
397(38)
Introduction
397(1)
Code Introduction
398(1)
Multicast Output Processing Revisited
399(2)
mrouted Daemon
401(3)
Virtual Interfaces
404(7)
IGMP Revisited
411(5)
Multicast Routing
416(8)
Multicast Forwarding: ip_mforward Function
424(9)
Cleanup: ip_mrouter_done Function
433(1)
Summary
434(1)
Socket Layer
435(40)
Introduction
435(1)
Code Introduction
436(1)
socket Structure
437(4)
System Calls
441(4)
Processes, Descriptions, and Sockets
445(2)
socket System Call
447(4)
getsock and sockargs Functions
451(2)
bind System Call
453(2)
listen System Call
455(1)
tsleep and wakeup Functions
456(1)
accept System Call
457(4)
sonewconn and soisconnected Functions
461(3)
connect System Call
464(4)
shutdown System Call
468(3)
close System Call
471(3)
Summary
474(1)
Socket I/O
475(62)
Introduction
475(1)
Code Introduction
475(1)
Socket Buffers
476(4)
write, writev, sendto, and sendmsg System Calls
480(3)
sendmsg System Call
483(2)
sendit Function
485(4)
sesoend Function
489(11)
read, readv, recvfrom, and recvmsg System Calls
500(1)
recvmsg System Call
501(2)
recvit Function
503(2)
soreceive Function
505(5)
soreceive Code
510(14)
select System Call
524(10)
Summary
534(3)
Socket Options
537(22)
Introduction
537(1)
Code Introduction
538(1)
setsockopt System Call
539(6)
getsockopt System Call
545(3)
fcntl and ioctl System Calls
548(6)
getsockname System Call
554(1)
getpeername System Call
554(3)
Summary
557(2)
Radix Tree Routing Tables
559(42)
Introduction
559(1)
Routing Table Structure
560(9)
Routing Sockets
569(1)
Code Introduction
570(3)
Radix Node Data Structures
573(5)
Routing Structures
578(3)
Intialization: route_init and rtable_init Functions
581(3)
Initialization: rn_init and rn_inithead Functions
584(3)
Duplicate Keys and Mask Lists
587(4)
rn_match Function
591(8)
rn_search Function
599(1)
Summary
599(2)
Routing Requests and Routing Messages
601(44)
Introduction
601(1)
rtalloc and rtalloc1 Functions
601(3)
RTFREE Macro and rtfree Function
604(3)
rtrequest Function
607(5)
rt_setgate Function
612(3)
rtinit Function
615(2)
rtredirect Function
617(4)
Routing Message Structures
621(4)
rt_missmsg Function
625(2)
rt_ifmsg Function
627(1)
rt_newaddrmsg Function
628(2)
rt_msg1 Function
630(2)
rt_msg2 Function
632(3)
sysct1_rtable Function
635(5)
sysct1_dumpentry Function
640(2)
sysctl_iflist Function
642(2)
Summary
644(1)
Routing Sockets
645(30)
Introduction
645(1)
routedomain and protosw Structures
646(1)
Routing control Blocks
647(1)
raw_init Function
647(1)
route_output Function
648(12)
rt_xaddrs Function
660(1)
rt_setmetrics Function
661(1)
raw_input Function
662(2)
route_usrreq Function
664(2)
raw_usrreq Function
666(5)
raw_attach, raw_detach, and raw_disconnect Functions
671(1)
Summary
672(3)
ARP: Address Resolution Protocol
675(38)
Introduction
675(1)
ARP and the Routing Table
675(3)
Code Introduction
678(3)
ARP Structures
681(2)
arpwhohas Function
683(1)
arprequest Function
684(3)
arpintr Function
687(1)
in_arpinput Function
688(6)
ARP Timer Functions
694(2)
arpresolve Function
696(5)
arplookup Function
701(2)
Proxy ARP
703(1)
arp_rtrequest Function
704(6)
ARP and Multicasting
710(1)
Summary
711(2)
Protocol Control Blocks
713(42)
Introduction
713(2)
Code Introduction
715(1)
inpcb Structure
716(1)
in_pcballoc and in_pcbdetach Functions
717(2)
Binding, Connecting, and Demultiplexing
719(5)
in_pcblookup Function
724(4)
in_pcbbind Function
728(7)
in_pcbconnect Function
735(6)
in_pcbdisconnect Function
741(1)
in_setsockaddr and in_setpeeraddr Functions
741(1)
in_pcbnotify, in_rtchange, and in_losing Functions
742(8)
Implementation Refinements
750(1)
Summary
751(4)
UDP: User Datagram Protocol
755(40)
Introduction
755(1)
Code Introduction
755(3)
UDP protosw Structure
758(1)
UDP Header
759(1)
udp_init Function
760(1)
udp_output Function
760(9)
udp_input Function
769(12)
udp_saveopt Function
781(1)
udp_ctlinput Function
782(2)
udp_usrreq Function
784(6)
udp_sysctl Function
790(1)
Implementation Refinements
791(2)
Summary
793(2)
TCP: Transmission Control Protocol
795(22)
Introduction
795(1)
Code Introduction
795(6)
TCP protosw Structure
801(1)
TCP Header
801(2)
TCP Control Block
803(2)
TCP State Transition Diagram
805(2)
TCP Sequence Numbers
807(5)
tcp_init Function
812(3)
Summary
815(2)
TCP Timers
817(34)
Introduction
817(2)
Code Introduction
819(2)
tcp_canceltimers Function
821(1)
tcp_fasttimo Function
821(1)
tcp_slowtimo Function
822(2)
tcp_timers Function
824(7)
Retransmission Timer Calculations
831(2)
tcp_newtcpcb Function
833(2)
tcp_setpersist Function
835(1)
tcp_xmit_timer Function
836(5)
Retransmission Timeout: tcp_timers Function
841(5)
An RTT Example
846(2)
Summary
848(3)
TCP Output
851(40)
Introduction
851(1)
tcp_output overview
852(1)
Determine if a Segment Should be Sent
852(12)
TCP Options
864(2)
Window Scale Option
866(1)
Timestamp Option
866(5)
Send a Segment
871(13)
tcp_template Function
884(1)
tcp_respond Function
885(3)
Summary
888(3)
TCP Functions
891(32)
Introduction
891(1)
tcp_drain Function
892(1)
tcp_drop Function
892(1)
tcp_close Function
893(4)
tcp_mss Function
897(7)
tcp_ctlinput Function
904(1)
tcp_notify Function
904(2)
tcp_quench Function
906(1)
TCP_REASS Macro and tcp_reass Function
906(10)
tcp_trace Function
916(4)
Summary
920(3)
TCP Input
923(44)
Introduction
923(2)
Preliminary Processing
925(8)
tcp_dooptions Function
933(1)
Header Prediction
934(7)
TCP Input: Slow Path Processing
941(1)
Initiation of Passive Open, Completion of Active Open
942(9)
PAWS: Protection Against Wrapped Sequence Numbers
951(3)
Trim Segment so Data is Within Window
954(6)
Self-Connects and Simultaneous Opens
960(3)
Record Timestamp
963(1)
RST Processing
963(2)
Summary
965(2)
TCP Input (Continued)
967(40)
Introduction
967(1)
ACK Processing Overview
967(1)
Completion of Passive Opens and Simultaneous Opens
967(3)
Fast Retransmit and Fast Recovery Algorithms
970(4)
ACK Processing
974(7)
Update Window Information
981(2)
Urgent Mode Processing
983(3)
tcp_pulloutofband Function
986(2)
Processing of Received Data
988(2)
FIN Processing
990(2)
Final Processing
992(2)
Implementation Refinements
994(1)
Header Compression
995(9)
Summary
1004(3)
TCP User Requests
1007(20)
Introduction
1007(1)
tcp_usrreq Function
1007(11)
tcp_attach Function
1018(1)
tcp_disconnect Function
1019(2)
tcp_usrclosed Function
1021(1)
tcp_ctloutput Function
1022(3)
Summary
1025(2)
BPF: BSD Packet Filter
1027(22)
Introduction
1027(1)
Code Introduction
1028(1)
bpf_if Structure
1029(3)
bpf_d Structure
1032(8)
BPF Input
1040(6)
BPF Output
1046(1)
Summary
1047(2)
Raw IP
1049(18)
Introduction
1049(1)
Code Introduction
1050(1)
Raw IP protosw Structure
1051(2)
rip_init Function
1053(1)
rip_input Function
1053(3)
rip_output Function
1056(2)
rip_usrreq Function
1058(5)
rip_ctloutput Function
1063(2)
Summary
1065(2)
Epilogue 1067(2)
Appendix A. Solutions to Selected Exercises 1069(24)
Appendix B. Source Code Availability 1093(4)
Appendix C. RFC 1122 Compliance 1097(28)
C.1 Link-Layer Requirements
1097(1)
C.2 IP Requirements
1098(4)
C.3 IP Options Requirements
1102(2)
C.4 IP Fragmentation and Reassembly Requirements
1104(1)
C.5 ICMP Requirements
1105(5)
C.6 Multicasting Requirements
1110(1)
C.7 IGMP Requirements
1111(1)
C.8 Routing Requirements
1111(2)
C.9 ARP Requirements
1113(1)
C.10 UDP Requirements
1113(2)
C.11 TCP Requirements
1115(10)
Bibliography 1125
Index 1113

Excerpts

Introduction This book describes and presents the source code for the common reference implementation of TCP/IP: the implementation from the Computer Systems Research Group (CSRG) at the University of California at Berkeley. Historically this has been distributed with the 4.x BSD system (Berkeley Software Distribution). This implementation was first released in 1982 and has survived many significant changes, much fine tuning, and numerous ports to other Unix and non-Unix systems. This is not a toy implementation, but the foundation for TCP/IP implementations that are run daily on hundreds of thousands of systems worldwide. This implementation also provides router functionality, letting us show the differences between a host implementation of TCP/IP and a router.We describe the implementation and present the entire source code for the kernel implementation of TCP/IP, approximately 15,000 lines of C code. The version of the Berkeley code described in this text is the 4.4BSD-Lite release. This code was made publicly available in April 1994, and it contains numerous networking enhancements that were added to the 4.3BSD Tahoe release in 1988, the 4.3BSD Reno release in 1990, and the 4.4BSD release in 1993. (App sourceB describes how to obtain this source code.) The 4.4BSD release provides the latest TCP/IP features, such as multicasting and long fat pipe support (for high-bandwidth, long-delay paths). {Fig 1.1} (p. 4) provides additional details of the various releases of the Berkeley networking code.This book is intended for anyone wishing to understand how the TCP/IP protocols are implemented: programmers writing network applications, system administrators responsible for maintaining computer systems and networks utilizing TCP/IP, and any programmer interested in understanding how a large body of nontrivial code fits into a real operating system. Organization of the Book We take a bottom-up approach to the TCP/IP protocol suite, starting at the data-link layer, then the network layer (IP, ICMP, IGMP, IP routing, and multicast routing), followed by the socket layer, and finishing with the transport layer (UDP, TCP, and raw IP). Intended Audience This book assumes a basic understanding of how the TCP/IP protocols work. Readers unfamiliar with TCP/IP should consult the first volume in this series, Stevens 1994, for a thorough description of the TCP/IP protocol suite. This earlier volume is referred to throughout the current text as Volume 1. The current text also assumes a basic understanding of operating system principles.We describe the implementation of the protocols using a data-structures approach. That is, in addition to the source code presentation, each chapter contains pictures and descriptions of the data structures used and maintained by the source code. We show how these data structures fit into the other data structures used by TCP/IP and the kernel. Heavy use is made of diagrams throughout the text - there are over 250 diagrams. This data-structures approach allows readers to use the book in various ways. Those interested in all the implementation details can read the entire text from start to finish, following through all the source code. Others might want to understand how the protocols are implemented by understanding all the data structurestand reading all the text, but not following through all the source code.We anticipate that many readers are interested in specific portions of the book and will want to go directly to those chapters. Therefore many forward and backward references are provided throughout the text, along with a thorough index, to allow individual chapters to be studied by themselves. The inside back covers contain an alphabetical cross-reference of all the functions and macros described in the book and the starting page number of the description. Exercises are provided at the end of the chapters; most solutions are in Appendix A to maximize the usefulnes

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.