Chinaunix首页 | 论坛 | 博客
  • 博客访问: 690911
  • 博文数量: 192
  • 博客积分: 1875
  • 博客等级: 上尉
  • 技术积分: 2177
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-23 23:21
个人简介

有时候,就是想窥视一下不知道的东东,因为好奇!

文章分类

全部博文(192)

文章存档

2024年(8)

2023年(3)

2020年(1)

2019年(1)

2018年(1)

2017年(2)

2016年(69)

2015年(53)

2014年(14)

2013年(1)

2012年(5)

2011年(25)

2010年(9)

分类: LINUX

2015-08-06 20:14:51

第9章 准备连接请求
    本章从客户端socket程序出发,沿着第二路线分析客户端与服务器的连接过程
    connect(client_fd, (struct sockaddr *)&server_address, server_len)
    其中server_address是服务器地址.
9.1 内核的连接函数
9.2 分配数据包结构和数据块空间
      ......前一篇

9.3 构建/发送TCP数据包
        struct tcp_hdr {
            ......
        };
        sys_socketcall()-->sys_connect()-->inet_stream_connect()-->tcp_v4_connect()-->tcp_connect()-->tcp_transmit_skb()-->__net_timestamp()
                                                                                                                                                                                                 -->skb_clone()-->__skb_clone()
                                                                                                                                                                                                 -->inet_sk()
                                                                                                                                                                                                 -->tcp_sk()
                                                                                                                                                                                                 -->TCP_SKB_CB()
                                                                                                                                                                                                 -->tcp_packets_in_flight()
                                                                                                                                                                                                 -->tcp_ca_event()
                                                                                                                                                                                                 -->skb_push()
                                                                                                                                                                                                 -->skb_reset_transport_header()
                                                                                                                                                                                                 -->skb_set_owner_w()
                                                                                                                                                                                                 -->tcp_hdr()-->skb_transport_header()
                                                                                                                                                                                                 -->TCP_ECN_send()
                                                                                                                                                                                                 -->tcp_v4_send_check()
                                                                                                                                                                                                 -->tcp_enter_cwr()
        __net_timestamp()记录当前时间
        tcp_transmit_skb()发送数据包
        inet_sk()取得inet_sock指针
        
tcp_sk()取得tcp_sock指针
        TCP_SKB_CB()取得tcp控制结构指针
        tcp_packets_in_flight()判断是否有数据包正在"飞行中"
        tcp_ca_event()调用拥塞窗口事件函数
        skb_push()调整数据块的起始地
        skb_reset_transport_header()数据包记录当前的TCP头部指针
        skb_set_owner_w()记录sock指针和计数器, 设置析构函数
        tcp_hdr()取得数据块中的TCP头部
        skb_transport_header()记录下TCP头部的位置 
        TCP_ECN_send()按照RFC793检查拥塞报告ECN
        tcp_v4_send_check()计算IPv4检验和, 以检查数据的完整性和准确性. 如果检验和超过FF, 就用补码表示
        tcp_enter_cwr()根据阻塞状态设置阻塞窗口相关内容

9.4 进化成IP数据包
9.5 进化成以太网数据包
9.6 发送以太网数据包
阅读(570) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~