TCP/IP详解 卷2:实现(英文版)

978-7-115-40128-1
作者: 【美】Gary R. Wright(加里 R.赖特) W. Richard Stevens(W.理查德•史蒂文斯)
译者: 无
编辑: 杨海玲

图书目录:

Chapter 1. Introduction/概述    1

1.1 Introduction / 概述 1

1.2 Source Code Presentation / 源代码表示 1

1.3 History / 历史 3

1.4 Application Programming Interfaces / 应用编程接口 5

1.5 Example Program / 示例程序 5

1.6 System Calls and Library Functions / 系统调用和库函数 7

1.7 Network Implementation Overview / 网络实现概述 9

1.8 Descriptors / 描述符 10

1.9 Mbufs (Memory Buffers) and Output Processing / Mbuf与输出处理 15

1.10 Input Processing / 输入处理 19

1.11 Network Implementation Overview Revisited / 网络实现概述(续) 22

1.12 Interrupt Levels and Concurrency / 中断级别与并发 23

1.13 Source Code Organization / 源代码组织 26

1.14 Test Network / 测试网络 28

1.15 Summary / 小结 29

Chapter 2. Mbufs: Memory Buffers / Mbuf:存储器缓冲区 31

2.1 Introduction / 概述 31

2.2 Code Introduction / 代码介绍 36

2.3 Mbuf Definitions / Mbuf定义 37

2.4 mbuf Structure / mbuf结构 38

2.5 Simple Mbuf Macros and Functions / 简单的Mbuf宏和函数 40

2.6 m_devget and m_pullup Functions / m_devget和m_pullup函数 44

2.7 Summary of Mbuf Macros and Functions / Mbuf宏和函数小结 51

2.8 Summary of Net/3 Networking Data Structures / Nef/3联网数据结构小结 54

2.9 m_copy and Cluster Reference Counts / m_copy和簇引用计数 56

2.10 Alternatives / 其他选择 60

2.11 Summary / 小结 60

Chapter 3. Interface Layer / 接口层 63

3.1 Introduction / 概述 63

3.2 Code Introduction / 代码介绍 64

3.3 ifnet Structure / ifnet结构 65

3.4 ifaddr Structure / ifaddr结构 73

3.5 sockaddr Structure / sockaddr结构 74

3.6 ifnet and ifaddr Specialization / ifnet和ifaddr专用化 76

3.7 Network Initialization Overview / 网络初始化概述 77

3.8 Ethernet Initialization / 以太网初始化 80

3.9 SLIP Initialization / SLIP初始化 82

3.10 Loopback Initialization / 环回初始化 85

3.11 if_attach Function / if_attach函数 85

3.12 ifinit Function / ifinit函数 93

3.13 Summary / 小结 94

Chapter 4. Interfaces: Ethernet / 接口:以太网95

4.1 Introduction / 概述 95

4.2 Code Introduction / 代码介绍 96

4.3 Ethernet Interface / 以太网接口 98

4.4 ioctl System call / ioctl系统调用 114

4.5 Summary / 小结 125

Chapter 5. Interfaces: SLIP and Loopback / 接口:SLIP和环回127

5.1 Introduction / 概述 127

5.2 Code Introduction / 代码介绍 127

5.3 SLIP Interface / SLIP接口 128

5.4 Loopback Interface / 环回接口 150

5.5 Summary / 小结 153

Chapter 6. IP Addressing / IP编址 155

6.1 Introduction / 概述 155

6.2 Code Introduction / 代码介绍 158

6.3 Interface and Address Summary / 接口和地址小结 158

6.4 sockaddr_in Structure / sockaddr_in结构 160

6.5 in_ifaddr Structure / in_ifaddr结构 161

6.6 Address Assignment / 地址指派 161

6.7 Interface ioctl Processing / 接口ioctl处理 177

6.8 Internet Utility Functions / Internet实用函数 181

6.9 ifnet Utility Functions / ifnet实用函数 182

6.10 Summary / 小结 183

Chapter 7. Domains and Protocols / 域和协议185

7.1 Introduction / 概述 185

7.2 Code Introduction / 代码介绍 186

7.3 domain Structure / domain结构 187

7.4 protosw Structure / protosw结构 188

7.5 IP domain and protosw Structures / IP的domain和protosw结构 191

7.6 pffindproto and pffindtype Functions / pffindproto和pffindtype函数 196

7.7 pfctlinput Function / pfctlinput函数 198

7.8 IP Initialization / IP初始化 199

7.9 sysctl System call / sysctl系统调用 201

7.10 Summary / 小结 204

Chapter 8. IP: Internet Protocol / IP:网际协议 205

8.1 Introduction / 概述 205

8.2 Code Introduction / 代码介绍 206

8.3 IP Packets / IP分组 210

8.4 Input Processing: ipintr Function / 输入处理:ipintr函数 212

8.5 Forwarding: ip_forward Function / 转发:ip_forward函数 220

8.6 Output Processing: ip_output Function / 输出处理:ip_output函数 228

8.7 Internet Checksum: in_cksum Function / Internet检验和:in_cksum函数 234

8.8 setsockopt and getsockopt System calls / setsockopt和getsockopt系统调用 239

8.9 ip_sysctl Function / ip_sysctl函数 244

8.10 Summary / 小结 245

Chapter 9. IP Option Processing / IP选项处理247

9.1 Introduction / 概述 247

9.2 Code Introduction / 代码介绍 247

9.3 Option Format / 选项格式 248

9.4 ip_dooptions Function / ip_dooptions函数 249

9.5 Record Route Option / 记录路由选项 252

9.6 Source and Record Route Options / 源站和记录路由选项254

9.7 Timestamp Option / 时间戳选项 261

9.8 ip_insertoptions Function / ip_insertoptions函数 265

9.9 ip_pcbopts Function / ip_pcbopts函数 269

9.10 Limitations / 一些限制 272

9.11 Summary / 小结 272

Chapter 10. IP Fragmentation and Reassembly / IP分片与重装275

10.1 Introduction / 概述 275

10.2 Code Introduction / 代码介绍 277

10.3 Fragmentation / 分片278

10.4 ip_optcopy Function / ip_optcopy函数 282

10.5 Reassembly / 重装 283

10.6 ip_reass Function / ip_reass函数 286

10.7 ip_slowtimo Function / ip_slowtimo函数 298

10.8 Summary / 小结 300

Chapter 11. ICMP: Internet Control Message Protocol / ICMP:因特网控制消息协议301

11.1 Introduction / 概述 301

11.2 Code Introduction / 代码介绍 305

11.3 icmp Structure / icmp结构308

11.4 ICMP protosw Structure / ICMP的protosw结构309

11.5 Input Processing: icmp_input Function / 输入处理:icmp_input函数 310

11.6 Error Processing / 错误处理313

11.7 Request Processing / 请求处理316

11.8 Redirect Processing / 重定向处理321

11.9 Reply Processing / 回答处理323

11.10 Output Processing / 输出处理324

11.11 icmp_error Function / icmp_error函数 324

11.12 icmp_reflect Function / icmp_reflect函数 328

11.13 icmp_send Function / icmp_send函数 333

11.14 icmp_sysctl Function / icmp_sysctl函数 334

11.15 Summary / 小结 335

Chapter 12. IP Multicasting / IP多播337

12.1 Introduction / 概述 337

12.2 Code Introduction / 代码介绍 340

12.3 Ethernet Multicast Addresses / 以太网多播地址 341

12.4 ether_multi Structure / ether_multi结构342

12.5 Ethernet Multicast Reception / 以太网多播接收344

12.6 in_multi Structure / in_multi 结构345

12.7 ip_moptions Structure / ip_moptions结构 347

12.8 Multicast Socket Options / 多播的套接字选项 348

12.9 Multicast TTL Values / 多播的TTL值348

12.10 ip_setmoptions Function / ip_setmoptions函数 351

12.11 Joining an IP Multicast Group / 加入一个IP多播组355

12.12 Leaving an IP Multicast Group / 离开一个IP多播组366

12.13 ip_getmoptions Function / ip_getmoptions函数 371

12.14 Multicast Input Processing: ipintr Function / 多播输入处理:ipintr函数 373

12.15 Multicast Output Processing: ip_output Function / 多播输出处理:ip_output函数 375

12.16 Performance Considerations / 性能的考虑379

12.17 Summary / 小结 379

Chapter 13. IGMP: Internet Group Management Protocol / Intemet组管理协议381

13.1 Introduction / 概述 381

13.2 Code Introduction / 代码介绍 382

13.3 igmp Structure / igmp结构 384

13.4 IGMP protosw Structure / IGMP的protosw结构 384

13.5 Joining a Group: igmp_joingroup Function / 加入一个组:igmp_joingroup函数 386

13.6 igmp_fasttimo Function / igmp_fasttimo函数 387

13.7 Input Processing: igmp_input Function / 输入处理:igmp_input函数 391

13.8 Leaving a Group: igmp_leavegroup Function / 离开一个组:igmp_leavegroup函数 395

13.9 Summary / 小结 396

Chapter 14. IP Multicast Routing / IP多播选路 397

14.1 Introduction / 概述397

14.2 Code Introduction / 代码介绍398

14.3 Multicast Output Processing Revisited / 多播输出处理(续) 399

14.4 mrouted Daemon / mrouted守护进程 401

14.5 Virtual Interfaces / 虚拟接口 404

14.6 IGMP Revisited / IGMP(续) 411

14.7 Multicast Routing / 多播选路 416

14.8 Multicast Forwarding: ip_mforward Function / 多播转发:ip_mforward函数 424

14.9 Cleanup: ip_mrouter_done Function / 清理:ip_mrouter_done函数 433

14.10 Summary / 小结 434

Chapter 15. Socket Layer / 套接字层 435

15.1 Introduction / 概述435

15.2 Code Introduction / 代码介绍436

15.3 socket Structure / socket结构 437

15.4 System Calls / 系统调用 441

15.5 Processes, Descriptors, and Sockets / 进程、描述符和套接字 445

15.6 socket System Call / socket系统调用447

15.7 getsock and sockargs Functions / getsock和sockargs函数 451

15.8 bind System Call / bind系统调用453

15.9 1isten System Call / 1isten系统调用 455

15.10 tsleep and wakeup Functions / tsleep和wakeup函数 456

15.11 accept System Call / accept系统调用457

15.12 sonewconn and soisconnected Functions / sonewconn和soisconnected函数 461

15.13 connect System call / connect系统调用 464

15.14 shutdown System call / shutdown系统调用 468

15.15 c1ose System call / c1ose系统调用 471

15.16 Summary / 小结 474

Chapter 16. Socket I/O / 套接字I/O 475

16.1 Introduction / 概述475

16.2 Code Introduction / 代码介绍475

16.3 Socket Buffers / 套接字缓冲区 476

16.4 write, writev, sendto, and sendmsg System calls / write、writev、sendto和sendmsg系统调用480

16.5 sendmsg System call / sendmsg系统调用 483

16.6 sendit Function / sendit函数 485

16.7 sosend Function / sosend函数 489

16.8 read, readv, recvfrom, and recvmsg System calls / read、readv、recvfrom和recvmsg系统调用 500

16.9 recvmsg System call / recvmsg系统调用 501

16.10 recvit Function / recvit函数 503

16.11 soreceive Function / soreceive函数 505

16.12 soreceive Code / soreceive代码510

16.13 se1ect System call / se1ect系统调用 524

16.14 Summary / 小结 534

Chapter 17. Socket Options / 套接字选项 537

17.1 Introduction / 概述537

17.2 Code Introduction / 代码介绍 538

17.3 setsockopt System call / setsockopt系统调用 539

17.4 getsockopt System call / getsockopt系统调用 545

17.5 font1 and ioct1 System call / font1和ioct1系统调用 548

17.6 getsockname System call / getsockname系统调用 554

17.7 getpeername System call / getpeername系统调用 554

17.8 Summary / 小结 557

Chapter 18. Radix Tree Routing Tables / Radix树选路表559

18.1 Introduction / 概述559

18.2 Routing Table Structure / 选路表结构 560

18.3 Routing Sockets / 选路套接字 569

18.4 Code Introduction / 代码介绍570

18.5 Radix Node Data Structures / Radix节点数据结构 573

18.6 Routing Structures / 选路结构 578

18.7 Initialization: route_init and rtable_init Functions / 初始化:route_init和rtable_init函数 581

18.8 Initialization: rn_init and rn_inithead Functions / 初始化:rn_init和rn_inithead函数 584

18.9 Duplicate Keys and Mask Lists / 重复键和掩码列表 587

18.10 rn_match Function / rn_match函数 591

18.11 rn_search Function / rn_search函数 599

18.12 Summary / 小结 599

Chapter 19. Routing Requests and Routing Messages / 选路请求和选路消息601

19.1 Introduction / 概述601

19.2 rtalloc and rtallocl Functions / rtalloc和rtallocl函数 601

19.3 RTFREE Macro and rtfree Function / RTFREE宏和rtfree函数 604

19.4 rtrequest Function / rtrequest函数 607

19.5 rt_setgate Function / rt_setgate函数 612

19.6 rtinit Function / rtinit函数 615

19.7 rtredirect Function / rtredirect函数 617

19.8 Routing Message Structures / 选路消息结构 621

19.9 rt_missmsg Function / rt_missmsg函数 625

19.10 rt_ifmsg Function / rt_ifmsg函数 627

19.11 rt_newaddrmsg Function / rt_newaddrmsg函数 628

19.12 rt_msg1 Function / rt_msg1函数 630

19.13 rt_msg2 Function / rt_msg2函数 632

19.14 sysctl_rtable Function / sysctl_rtable函数 635

19.15 sysctl_dumpentry Function / sysctl_dumpentry函数 640

19.16 sysctl_iflist Function / sysctl_iflist函数 642

19.17 Summary / 小结 644

Chapter 20. Routing Sockets / 选路套接字 645

20.1 Introduction / 概述645

20.2 routedomain and protosw Structures / routedomain和protosw结构 646

20.3 Routing Control Blocks / 选路控制块 647

20.4 raw_init Function / raw_init函数 647

20.5 route_output Function / route_output函数 648

20.6 rt_xaddrs Function / rt_xaddrs函数 660

20.7 rt_setmetrics Function / rt_setmetrics函数 661

20.8 raw_input Function / raw_input函数 662

20.9 route_usrreq Function / route_usrreq函数 664

20.10 raw_usrreq Function / raw_usrreq函数 666

20.11 raw_attach, raw_detach, and raw_disconnect Functions / raw_attach、raw_detach和raw_disconnect函数 671

20.12 Summary / 小结 672

Chapter 21. ARP: Address Resolution Protocol / ARP:地址解析协议 675

21.1 Introduction / 概述675

21.2 ARP and the Routing Table / ARP及选路表 675

21.3 Code Introduction / 代码介绍678

21.4 ARP Structures / ARP结构 681

21.5 arpwhohas Function / arpwhohas函数 683

21.6 arprequest Function / arprequest函数 684

21.7 arpintr Function / arpintr函数 687

21.8 in_arpinput Function / in_arpinput函数 688

21.9 ARP Timer Functions / ARP定时器函数 694

21.10 arpresolve Function / arpresolve函数 696

21.11 arplookup Function / arplookup函数 701

21.12 Proxy ARP / 代理ARP 703

21.13 arp_rtrequest Function / arp_rt request函数 704

21.14 ARP and Multicasting / ARP和多播 710

21.15 Summary / 小结 711

Chapter 22. Protocol Control Blocks / 协议控制块 713

22.1 Introduction / 概述713

22.2 Code Introduction / 代码介绍715

22.3 inpcb Structure / inpcb结构716

22.4 in_pcballoc and in_pcbdetach Functions / in_pcballoc和in_pcbdetach函数 717

22.5 Binding, Connecting, and Demultiplexing / 绑定、连接和多路分配 719

22.6 in_pcblookup Function / in_pcblookup函数 724

22.7 in_pcbbind Function / in_pcbbind函数 728

22.8 in_pcbconnect Function / in_pcbconnect函数 735

22.9 in_pcbdisconnect Function / in_pcbdisconnect函数 741

22.10 in_setsockaddr and in_setpeeraddr Functions / in_setsockaddr和in_setpeeraddr函数 741

22.11 in_pcbnotify, in_rtchange, and in_losing Functions / in_pcbnotify、in_rtchange和 in_losing函数 742

22.12 Implementation Refinements / 实现细化 750

22.13 Summary / 小结 751

Chapter 23. UDP: User Datagram Protocol / UDP:用户数据报协议755

23.1 Introduction / 概述755

23.2 Code Introduction / 代码介绍755

23.3 UDP protosw Structure / UDP的protosw结构 758

23.4 UDP Header / UDP首部 759

23.5 udp_init Function / udp_init函数 760

23.6 udp_output Function / udp_output函数 760

23.7 udp_input Function / udp_input函数 769

23.8 udp_saveopt Function / udp_saveopt函数 781

23.9 udp_ct1input Function / udp_ct1input函数 782

23.10 udp_usrreq Function / udp_usrreq函数 784

23.11 udp_sysct1 Function / udp_sysct1函数 790

23.12 Implementation Refinements / 实现细化 791

23.13 Summary / 小结 793

Chapter 24. TCP: Transmission Control Protocol / TCP:传输控制协议 795

24.1 Introduction / 概述795

24.2 Code Introduction / 代码介绍795

24.3 TCP protosw Structure / TCP的protosw结构801

24.4 TCP Header / TCP首部 801

24.5 TCP Control Block / TCP控制块 803

24.6 TCP State Transition Diagram / TCP状态变迁图 805

24.7 TCP Sequence Numbers / TCP序列号807

24.8 tcp_init Function / tcp_init函数 812

24.9 Summary / 小结 815

Chapter 25. TCP Timers / TCP定时器817

25.1 Introduction / 概述817

25.2 Code Introduction / 代码介绍819

25.3 tcp_canceltimers Function / tcp_canceltimers函数 821

25.4 tcp_fasttimo Function / tcp_fasttimo函数 821

25.5 tcp_s1owtimo Function / cp_s1owtimo函数 822

25.6 tcp_timers Function / cp_timers函数 824

25.7 Retransmission Timer Calculations / 重传定时器计算 831

25.8 tcp_newtcpcb Function / tcp_newtcpcb函数 833

25.9 tcp_setpersist Function / tcp_setpersist函数 835

25.10 tcp_xmit_timer Function / tcp_xmit_timer函数 836

25.11 Retransmission Timeout: tcp_timers Function / 重传超时:tcp_timers函数 841

25.12 An RTT Example / RTT示例846

25.13 Summary / 小结 848

Chapter 26. TCP Output / TCP输出 851

26.1 Introduction / 概述851

26.2 tcp_output Overview / tcp_output概述 852

26.3 Determine if a Segment Should be Sent / 确定一个段是否应该发送852

26.4 TCP Options / TCP选项 864

26.5 Window Scale Option / 窗口缩放选项 866

26.6 Timestamp Option / 时间戳选项 866

26.7 Send a Segment / 发送一个段 871

26.8 tcp_template Function / tcp_template函数 884

26.9 tcp_respond Function / tcp_respond函数 885

26.10 Summary / 小结 888

Chapter 27. TCP Functions / TCP函数 891

27.1 Introduction / 概述891

27.2 tcp_drain Function / tcp_drain函数 892

27.3 tcp_drop Function / tcp_drop函数 892

27.4 tcp_close Function / tcp_close函数 893

27.5 tcp_mss Function / tcp_mss函数 897

27.6 tcp_ctlinput Function / tcp_ctlinput函数 904

27.7 tcp_notify Function / tcp_notify函数 904

27.8 tcp_quench Function / tcp_quench函数 906

27.9 TCP_REASS Macro and tcp_reass Function / TCP_REASS宏tcp_reass函数 906

27.10 tcp_trace Function / tcp_trace函数 916

27.11 Summary / 小结 920

Chapter 28. TCP Input / TCP输入923

28.1 Introduction / 概述923

28.2 Preliminary Processing / 初步处理925

28.3 tcp_dooptions Function / tcp_dooptions函数 933

28.4 Header Prediction / 首部预测 934

28.5 TCP Input: Slow Path Processing / TCP输入:慢路径处理 941

28.6 Initiation of Passive Open, Completion of Active Open / 被动打开的开始,主动打开的完成 942

28.7 PAWS: Protection Against Wrapped Sequence Numbers / PAWS:包装序列号保护 951

28.8 Trim Segment so Data is Within Window / 修剪段使数据在窗口中 954

28.9 Self-Connects and Simultaneous Opens / 自连接和同时打开 960

28.10 Record Timestamp / 记录时间戳 963

28.11 RST Processing / RST处理 963

28.12 Summary / 小结 965

Chapter 29. TCP Input (Continued) / TCP输入(续)967

29.1 Introduction / 概述967

29.2 ACK Processing Overview / ACK处理概述 967

29.3 Completion of Passive Opens and Simultaneous Opens / 被动打开和同时打开的完成967

29.4 Fast Retransmit and Fast Recovery Algorithms / 快速重传及快速恢复算法 970

29.5 ACK Processing / ACK处理974

29.6 Update Window Information / 更新窗口信息 981

29.7 Urgent Mode Processing / 紧急模式处理983

29.8 tcp_pulloutofband Function / tcp_pulloutofband函数 986

29.9 Processing of Received Data / 接收到的数据的处理 988

29.10 FIN Processing / FIN处理990

29.11 Final Processing / **终处理992

29.12 Implementation Refinements / 实现细化994

29.13 Header Compression / 首部压缩 995

29.14 Summary / 小结 1004

Chapter 30. TCP User Requests / TCP用户请求1007

30.1 Introduction / 概述1007

30.2 tcp_usrreq Function / tcp_usrreq函数 1007

30.3 tcp_attach Function / tcp_attach函数 1018

30.4 tcp_disconnect Function / tcp_disconnect函数 1019

30.5 tcp_usrclosed Function / tcp_usrclosed函数 1021

30.6 tcp_ctloutput Function / tcp_ctloutput函数 1022

30.7 Summary / 小结 1025

Chapter 31. BPF: BSD Packet Filter / BPF:BSD分组过滤程序1027

31.1 Introduction / 概述1027

31.2 Code Introduction / 代码介绍1028

31.3 bpf_if Structure / bpf_if结构 1029

31.4 bpf_d Structure / bpf_d结构 1032

31.5 BPF Input / BPF输入 1040

31.6 BPF Output / BPF输出1046

31.7 Summary / 小结 1047

Chapter 32. 原始IP 1049

32.1 Introduction / 概述1049

32.2 Code Introduction / 代码介绍1050

32.3 Raw IP protosw Structure / 原始IP的protosw结构1051

32.4 rip_init Function / rip_init函数 1053

32.5 rip_input Function / rip_input函数 1053

32.6 rip_output Function / rip_output函数 1056

32.7 rip_usrreq Function / rip_usrreq函数 1058

32.8 rip_ctloutput Function / rip_ctloutput函数 1063

32.9 Summary / 小结 1065

Epilogue / 后记1067

Appendix A. Solutions to Selected Exercises / 精选习题的解答1069

Appendix B. Source Code Availability / 源代码的获取1093

Appendix C. RFC 1122 Compliance / RFC 1122的有关内容1097

C.1 Link-Layer Requirements / 链路层要求1097

C.2 IP Requirements / IP要求1098

C.3 IP Options Requirements / IP选项要求 1102

C.4 IP Fragmentation and Reassembly Requirements / 分片和组装要求1104

C.5 ICMP Requirements / ICMP要求1105

C.6 Multicasting Requirements / 多播要求 1110

C.7 IGMP Requirements / IGMP 要求1111

C.8 Routing Requirements / 选路要求1111

C.9 ARP Requirements / ARP要求 1113

C. 10 UDP Requirements / UDP要求 1113

C. 11 TCP Requirements / TCP要求 1115

Bibliography / 参考文献 1125

详情

本书是TCP/IP领域的经典之作!书中完整而详细地介绍了TCP/IP协议是如何实现的。本书介绍了一个实际的TCP/IP实现,并给出了这一实现的完整源代码,帮助读者全面掌握TCP/IP的实现。本书内容详尽且具权威性,几乎每章都提供精选的习题,并在附录中提供了部分习题的答案。

图书摘要

相关图书

Web应用安全
Web应用安全
企业“IPv6+”网络规划设计与演进
企业“IPv6+”网络规划设计与演进
“IPv6+”网络技术创新:构筑数字经济发展基石
“IPv6+”网络技术创新:构筑数字经济发展基石
社交网络对齐
社交网络对齐
华为HCIA路由交换认证指南
华为HCIA路由交换认证指南
非常网管 IPv6网络部署实战
非常网管 IPv6网络部署实战

相关文章

相关课程