Chapter 1 Introduction And Overview 1
1.1 TCP/IP Protocols 1
1.2 The Need To Understand Details 1
1.3 Complexity Of Interactions Among Protocols 2
1.4 The Approach In This Text 2
1.5 The Importance Of Studying Code 3
1.6 The Xinu Operating System 3
1.8 Summary 4
1.7 Organization Of The Remainder Of The Book 4
Chapter 2 The Structure Of TCP/IP Software In An Operating System 7
2.1 Introduction 7
2.2 The Process Concept 8
2.3 Process Priority 9
2.4 Communicating Processes 9
2.5 Interprocess Communication 12
2.13 UDP Output 12
2.6 Device Drivers, Input , And Output 14
2.7 Network Input and Interrupts 14
2.9 Passing Datagrams From IP To Transport Protocols 16
2.8 Passing Packets To Higher Level Protocols 16
2.10 Delivery To Application Programs 18
2.11 Information Flow On Output 19
2.12 From TCP Through IP To Network Output 20
2.14 Summary 21
Chapter 3 Network Interface Layer 27
3.1 Introduction 27
3.2 The Network Interface Abstraction 28
3.4 Local Host Interface 31
3.3 Logical State Of An Interface 31
3.5 Buffer Management 32
3.6 Demultiplexing Incoming Packets 35
3.7 Summary 36
Chapter 4 Address Discovery And Binding(ARP) 39
4.1 Introduction 39
4.2 Conceptual Organization Of ARP Software 40
4.3 Example ARP Design 40
4.4 Data Structures For The ARP Cache 41
4.5 ARP Output Processing 44
4.6 ARP Input Processing 49
4.7 ARP Cache Management 53
4.8 ARP Initialization 58
4.9 ARP Configuration Parameters 59
4.10 Summary 59
Chapter 5 IP:Global Software Organization 61
5.1 Introduction 61
5.2 The Central Switch 61
5.3 IP Software Design 62
5.4 IP Software Organization And Datagram Flow 63
5.5 Byte-Ordering In The IP Header 76
5.6 Sending A Datagram To IP 77
5.7Table Maintenance 80
5.8 Summary 82
Chapter 6 IP:Routing Table And Routing Algorithm 85
6.1 Introduction 85
6.2 Route Maintenance And Lookup 85
6.3 Routing Table Organization 86
6.4 Routing Table Data Structures 87
6.5 Origin Of Routes And Persistence 89
6.6 Routing A Datagram 89
6.7 Periodic Route Table Maintenance 96
6.8 IP Options Processing 104
6.9 Summary 105
Chapter 7 IP:Fragmentation And Reassembly 107
7.1 Introduction 107
7.2 Fragmenting Datagrams 107
7.3 Implementation Of Fragmentation 108
7.4 Datagram Reassembly 113
7.5 Maintenance Of Fragment Lists 122
7.6 Initialization 124
7.7 Summary 124
Processing(ICMP) 127
8.1Introduction 127
8.2 ICMP Message Formats 127
8.3 Implementation Of ICMP Messages 127
8.4 Handling Incoming ICMP Messages 130
8.5 Handling An ICMP Redirect Message 132
8.6 Setting A Subnet Mask 133
8.7 Choosing A Source Address For An ICMP Packet 135
8.8 Generating ICMP Error Messages 136
8.9 Avoiding Errors About Errors 139
8.10 Allocating A Buffer For ICMP 140
8.11 The Data Portion Of An ICMP Message 142
8.12 Generating An ICMP Redirect Message 144
8.13 Summary 145
9.2 Maintaining Multicast Group Membership Information 147
Chapter 9 IP : Multicast Processing(IGMP) 147
9.1 Introduction 147
9.3 A Host Group Table 148
9.4 Searching For A Host Group 150
9.5 Adding A Host Group Entry To The Table 151
9.6 Configuring The Network Interface For A Multicast Address 152
9.7 Translation Between IP and Hardware Multicast Addresses 154
9.8 Removing A Multicast Address From The Host Group Table 156
9.9 Joining A Host Group 157
9.10 Maintaining Contact With A Multicast Router 158
9.11 Implementing IGMP Membership Reports 160
9.12 Computing A Random Delay 161
9.13 A Process To Send IGMP Reports 163
9.14 Handling Incoming IGMP Messages 164
9.15 Leaving A Host Group 165
9.16 Initialization Of IGMP Data Structures 167
9.17 Summary 168
10.2 UDP Ports And Demultiplexing 171
10.1 Introduction 171
Chapter 10 UDP : User Datagrams 171
10.3 UDP 175
10.4 UDP Output Processing 185
10.5 Summary 188
Chapter 11 TCP : Data Structures And Input Processing 191
11.1 Introduction 191
11.2 Overview Of TCP Software 192
11.3 Transmission Control Blocks 192
11.4 TCP Segment Formal 196
11.5 Sequence Space Comparison 198
11.6 TCP Finite State Machine 199
11.7 Example State Transition 200
11.8 Declaration Of The Finite State Machine 200
11.9 TCB Allocation And Initialization 202
11.10 Implementation Of TheFinite State Machine 204
11.11 Handling An Input Segment 205
11.12 Summary 214
12.2 CLOSED State Processing 217
12.1 Introduction 217
Chapter 12 TCP : Finite State Machine Implementation 217
12.3 Graceful Shutdown 218
12.4 Timed Delay After Closing 218
12.5 TIME-WAIT State Processing 219
12.6 CLOSING State Processing 221
12.7 FIN-WAIT-2 State Processing 222
12.8 FIN-WAIT-1 State Processing 223
12.9 CLOSE-WAIT State Processing 225
12.10 LAST-ACK State Processing 227
12.11 ESTABLISHED State Processing 228
12.12 Processing Urgent Data In A Segment 229
12.13 Processing Other Data In A Segment 231
12.14 Keeping Track Of Received Octets 233
12.15 Aborting A TCP Connection 236
12.16 Establishing A TCP Connection 237
12.17 Initializing A TCB 237
12.18 SYN-SENT State Processing 239
12.19 SYN-RECEIVED State Processing 240
12.20 LISTEN State Processing 243
12.21 Initializing Window Variables For A New TCB 244
12.22 Summary 246
Chapter 13 TCP : Output Processing 247
13.1 Introduction 247
13.2 Controlling TCP Output Complexity 247
13.3 The Four TCP Output States 248
13.4 TCP Output As A Process 248
13.5 TCP Output Messages 249
13.6 Encoding Output States And TCB Numbers 250
13.7 Implementation Of The TCP Output Process 250
13.8 Mutual Exclusion 251
13.9 Implementation Of The IDLE State 252
13.10 Implementation Of The PERSIST State 252
13.11 Implementation Of The TRANSUIT State 253
13.12 Implementation Of The RETRANSMIT State 255
13.13 Sending A Segment 255
13.14 Computing The TCP Data Length 259
13.15 Computing Sequence Counts 260
13.16 Other TCP Procedures 261
13.17 Summary 267
Chapter 14 TCP : Timer Management 269
14.1 Introduction 269
14.2 A General Data Structure For Timed Events 269
14.3 A Data Structure For TCP Events 270
14.4 Timers, Events, And Messages 271
14.5 The TCP Timer Process 272
14.6 Deleting A TCP Timer Event 274
14.7 Deleting All Events For A TCB 275
14.8 Determining The Time Remaining For An Event 276
14.9 Inserting A TCP Timer Event 277
14.10 Starting TCP Output Without Delay 279
14.11 Summary 280
Chapter 15 TCP : Flow Control And Adaptive Retransmission 283
15.1 Introduction 283
15.2 The Difficulties With Adaptive Retransmission 284
15.3 Tuning Adaptive Retransmission 284
15.4 Retransmission Timer And Backoff 284
15.5 Window-Based Flow Control 287
15.6 Maximum Segment Size Computation 291
15.7 Congestion Avoidance And Control 295
15.8 Slow-Start And Congestion Avoidance 296
15.9 Round Trip Estimation And Timeout 299
15.10 Miscellaneous Notes And Techniques 305
15.11 Summary 306
Chapter 16 TCP : Urgent Data Processing And The Push Function 309
16.1 Introduction 309
16.2 Out-Of-Band Signaling 309
16.4 Interpreting The Standard 310
16.3 Urgent Data 310
16.5 Configuration For Berkeley Urgent Pointer Interpretation 313
16.6 Informing An Application 313
16.7 Reading Data From TCP 314
16.8 Sending Urgent Data 316
16.9 TCP Push Function 317
16.10 Interpreting Push With Out-Of-Order Delivery 318
16.11 Implementation Of Push On Input 319
16.12 Summary 320
Chapter 17 Socket-Level Interface 323
17.1 Introduction 323
17.2 Interfacing Through A Device 323
17.3 TCP Connections As Devices 325
17.4 An Example TCP Client Program 326
17.5 An Example TCP Server Program 327
17.6 Implementation Of The TCP Master Device 329
17.7 Implementation Of A TCP Slave Device 337
17.8 Initialization Of A Slave Device 351
17.9 Summary 352
Chapter 18 RIP : Active Route Propagation And Passive Acquisition 355
18.1 Introduction 355
18.2 Active And Passive Mode Participants 356
18.3 Basic RIP Algorithm And Cost Metric 356
18.4 Instabilities And Solutions 357
18.5 Message Types 361
18.6 Protocol Characterization 361
18.7 Implementation Of RIP 362
18.8 The Principle RIP Process 365
18.9 Responding To An Incoming Request 370
18.10 Generating Update Messages 372
18.11Initializing Copies Of An Update Message 373
18.12 Generating Periodic RIP Output 378
18.13 Limitations Of RIP 379
18.14 Summary 379
Chapter 19 OSPF : Route Propagation With An SPF Algorithm 381
19.1 Introduction 381
19.2 OSPF Configuration And Options 382
19.3 OSPF s Graph-Theoretic Model 382
19.4 OSPF Declarations 386
19.5 Adjacency And Link State Propagation 391
19.6 Discovering Neighboring Gateways With Hello 392
19.7 Sending Hello Packets 394
19.8 Designated Router Concept 399
19.9 Electing A Designated Router 400
19.10 Reforming Adjacencies After A Change 404
19.11 Handling Arriving Hello Packets 406
19.12 Adding A Gateway To The Neighbor List 408
19.13 Neighbor State Transitions 410
19.14 OSPF Timer Events And Retransmissions 412
19.15 Determining Whether Adjacency Is Permitted 414
19.16 Handling OSPF input 415
19.17 Declarations And Procedures For Link State Processing 418
19.18 Generating Database Description Packets 421
19.19 Creating A Template 422
19.20 Transmitting A Database Description Packet 424
19.21 Handling An Arriving Database Description Packet 426
19.22 Handling Link State Request Packets 432
19.23 Building A Link State Summary 434
19.24OSPF Utility Procedures 435
19.25 Summary 439
Chapter 20 SNMP : MIB Variables, Representations,And Bindings 441
20.1 Introduction 441
20.2 Server Organization And Name Mapping 442
20.3 MIB Variables 443
20.4 MIB Variable Names 444
20.6 Prefix Removal 445
20.5Lexicographic Ordering Among Names 445
20.7 Operations Applied To MIB Variables 446
20.8 Names For Tables 446
20.9 Conceptual Threading Of The Name Hierarchy 447
20.10 Data Structure For MIB Variables 448
20.11 A Data Structure For Fast Lookup 450
20.12 Implementation Of The Hash Table 452
20.13 Specification Of MIB Bindings 452
20.14 Internal Variables Used In Bindings 457
20.15 Hash Table lookup 458
20.16 SNMP Structures And Constants 461
20.17 ASN.I Representation Manipulation 464
20.18 Summary 474
Chapter 21 SNMP : Client And Server 477
21.1 Introduction 477
21.2 Data Representation In The Server 477
21.3 Server Implementation 478
21.4 Parsing An SNMP Message 480
21.5 Converting ASN.1 Names In The Binding List 484
21.6 Resolving A Query 485
21.8 Indirect Application Of Operations 487
21.7 Interpreting The Get-Next Operation 487
21.9 Indirection For Tables 490
21.10 Generating A Reply Message Backward 491
21.11 Converting From Internal Form to ASN.I 494
21.12 Utility Functions Used By The Server 495
21.13 Implementation Of An SNMP Client 496
21.14 Initialization Of Variables 498
21.15 Summary 500
22.1 Introduction 503
Chapter 22 SNMP : Table Access Functions 503
22.3 Object Identifiers For Tables 504
22.4 Address Entry Table Functions 504
22.2 Table Access 504
22.5 Address Translation Table Functions 511
22.6 Network Interface Table Functions 521
22.7 Routing Table Functions 529
22.8 TCP Connection Table Functions 538
22.9Summary 545
23.2 Statistical Analysis Of The Code 547
Chapter 23 Implementation In Retrospect 547
23.1 Introduction 547
23.3 Lines Of Code For Each Protocol 548
23.4 Functions And Procedures For Each Protocol 550
23.5 Summary 551
Appendix 1 Cross Reference Of Procedure Calls 553
Appendix 2 Xinu Functions And Constants Used In The Code 573
Bibliography 589
Index 597