亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tcp.inc

?? MenuetOS是一個(gè)用匯編開發(fā)的32/64位PC操作系統(tǒng)
?? INC
?? 第 1 頁 / 共 3 頁
字號:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                 ;;
;;  TCP.INC                                                        ;;
;;                                                                 ;;
;;  TCP Processes for Menuet OS  TCP/IP stack                      ;;
;;                                                                 ;;
;;  Version 0.6  4th July 2004                                       ;;
;;                                                                 ;;
;;  Copyright 2002 Mike Hibbett, mikeh@oceanfree.net               ;;
;;                                                                 ;;
;;  See file COPYING for details                                   ;;
;;  v0.6 : Added reset handling in the established state           ;;
;;         Added a timer per socket to allow delays when rx window ;;
;;         gets below 1KB                                          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   
   
;*******************************************************************
;   Interface
;
;       tcp_tx_handler      Handles the TCP transmit queue
;       tcp_rx              The protocol handler for received data
;       buildTCPPacket      fills in the packet headers and data
;       tcpStateMachine     Main state machine for received TCP packets
;       tcp_tcb_handler     1s timer, to erase tcb's in TIME_WAIT state
;
;*******************************************************************
   


;***************************************************************************
;   Function
;      tcp_tcb_handler
;
;   Description
;       Handles sockets in the timewait state, closing them
;       when the TCB timer expires
;
;***************************************************************************
tcp_tcb_handler:
    ; scan through all the sockets, decrementing active timers
    
    mov     eax, SOCKETBUFFSIZE * NUM_SOCKETS
    mov     ecx, NUM_SOCKETS
   
tth1:
    sub     eax, SOCKETBUFFSIZE
    cmp     [eax + sockets + 32], dword 0
    jne     tth2

tth1a:
    cmp     [eax + sockets + 72], dword 0
    jne     tth4
        
    loop    tth1
    ret

tth2: 
    ; decrement it, delete socket if TCB timer = 0 & socket in timewait state
    pusha
    dec     dword [eax + sockets + 32]
    cmp     [eax + sockets + 32], dword 0
    jne     tth3
    
    cmp     [eax + sockets + 28], dword TCB_TIME_WAIT
    jne     tth3
    
    ; OK, delete socket
    mov     edi, eax
    add     edi, sockets
    
    xor     eax, eax
    mov     ecx, SOCKETHEADERSIZE
    cld
    rep     stosb
    
tth3:
    popa
    
    jmp     tth1a
    
    loop    tth1
    ret
    
    ; TODO - prove it works!
tth4:
    dec     dword [eax + sockets + 72]    
    loop    tth1
    ret
    
    
    

tth_exit:
    ret
    

;***************************************************************************
;   Function
;      tcp_tx_handler
;
;   Description
;       Handles queued TCP data
;       This is a kernel function, called by stack_handler
;
;***************************************************************************
tcp_tx_handler:
    ; decrement all resend buffers timers. If they
    ; expire, queue them for sending, and restart the timer.
    ; If the retries counter reach 0, delete the entry

    mov     esi, resendQ
    mov     ecx, 0
    
tth001:
    cmp     ecx, NUMRESENDENTRIES
    je      tth003              ; None left
    cmp     [esi], byte 0xFF
    jne      tth002             ; found one
    inc     ecx
    add     esi, 4
    jmp     tth001

tth002:    
    ; we have one. decrement it's timer by 1
    dec     word [esi+2]
    mov     ax, [esi+2]
    cmp     ax, 0
    je     tth002a
    inc     ecx
    add     esi, 4
    jmp     tth001              ; Timer not zero, so move on

tth002a:   
    mov     bl, 0xff 
    ; restart timer, and decrement retries
    ; After the first resend, back of on next, by a factor of 5
    mov     [esi+2], word TCP_TIMEOUT * 5
    dec     byte [esi+1]
    mov     al, [esi+1]
    cmp     al, 0
    jne     tth004
    
    ; retries now 0, so delete from queue
    xchg     [esi], bl
tth004:

    ; resend packet
    pusha   

    mov     eax, EMPTY_QUEUE
    call    dequeue
    cmp     ax, NO_BUFFER
    jne      tth004z              
    
    ; TODO - try again in 10ms.
    cmp     bl, 0xff
    jne     tth004za
    mov     [esi], bl
    
tth004za:    
    ; Mark it to expire in 10ms - 1 tick
    mov     [esi+1], byte 1
    mov     [esi+2], word 1
    jmp     tth005

tth004z:    
    ; we have a buffer # in ax
    
    push    eax
    push    ecx
    mov     ecx, IPBUFFSIZE
    mul     ecx
    add     eax, IPbuffs

    ; we have the buffer address in eax
    mov     edi, eax
    pop     ecx
    ; get resend data address
    inc     ecx
    ; Now get buffer location, and copy buffer across. argh! more copying,,
    mov     esi, resendBuffer - IPBUFFSIZE
tth004a:
    add     esi, IPBUFFSIZE
    loop    tth004a
   
    ; we have resend buffer location in esi
    mov     ecx, IPBUFFSIZE
    
    ; copy data across
    cld
    rep     movsb
    
    ; queue packet
    
    
    
    mov     eax, NET1OUT_QUEUE

    mov     edx, [stack_ip]
    mov     ecx, [ edi + 16 ]
    cmp     edx, ecx
    jne     tth004b
    mov     eax, IPIN_QUEUE
    
tth004b:
    pop     ebx
    
    call    queue
       

tth005:    
    popa    
    
    inc     ecx
    add     esi, 4
    jmp     tth001

tth003:    
    ret
    
    


;***************************************************************************
;   Function
;      tcp_rx
;
;   Description
;       TCP protocol handler
;       This is a kernel function, called by ip_rx
;       IP buffer address given in edx
;          IP buffer number in eax
;          Free up (or re-use) IP buffer when finished
;
;***************************************************************************
tcp_rx:
    ; The process is as follows.
    ; Look for a socket with matching remote IP, remote port, local port
    ; if not found, then
    ; look for remote IP + local port match ( where sockets remote port = 0)
    ; if not found, then
    ; look for a socket where local socket port == IP packets remote port
    ; where sockets remote port, remote IP = 0
    ; discard if not found
    ; Call sockets tcbStateMachine, with pointer to packet.
    ; the state machine will not delete the packet, so do that here.

    push        eax
    
    ; Look for a socket where
    ; IP Packet TCP Destination Port = local Port
    ; IP Packet SA = Remote IP
    ; IP Packet TCP Source Port = remote Port
   
    mov     eax, SOCKETBUFFSIZE * NUM_SOCKETS
    mov     ecx, NUM_SOCKETS
ss1:
    sub     eax, SOCKETBUFFSIZE    
    movzx   ebx, word [edx + 22]     ; get the dest. port from the TCP hdr
    cmp     [eax + sockets + 12], bx ; compare with socket's local port
    jnz     nxttst1                        ; different - try next socket        

    movzx   ebx, word [edx + 20]       ; get the source port from the TCP hdr
    cmp     [eax + sockets + 20], bx ; compare with socket's remote port
    jnz     nxttst1                        ; different - try next socket        


    mov     ebx, [edx + 12]           ; get the source IP Addr from the IP hdr
    cmp     [eax + sockets + 16], ebx ; compare with socket's remote IP
    jnz     nxttst1                        ; different - try next socket        

    ; We have a complete match - use this socket
    jmp     tcprx_001

nxttst1:
    loop    ss1                     ; Return back if no match
   
    ; If we got here, there was no match
    ; Look for a socket where
    ; IP Packet TCP Destination Port = local Port
    ; IP Packet SA = Remote IP
    ; socket remote Port = 0
   
    mov     eax, SOCKETBUFFSIZE * NUM_SOCKETS
    mov     ecx, NUM_SOCKETS
    
ss2:
    sub     eax, SOCKETBUFFSIZE

    movzx   ebx, word [edx + 22]     ; get the dest. port from the TCP hdr
    cmp     [eax + sockets + 12], bx ; compare with socket's local port
    jnz     nxttst2                        ; different - try next socket        

    mov     ebx, [edx + 12]          ; get the source IP Addr from the IP hdr
    cmp     [eax + sockets + 16], ebx ; compare with socket's remote IP
    jnz     nxttst2                        ; different - try next socket        

    mov     ebx, 0
    cmp     [eax + sockets + 20], bx ; only match a remote socket of 0
    jnz     nxttst2                        ; different - try next socket        

    ; We have a complete match - use this socket
    jmp     tcprx_001

nxttst2:
    loop    ss2                     ; Return back if no match

    ; If we got here, there was no match
    ; Look for a socket where
    ; IP Packet TCP Destination Port = local Port
    ; socket Remote IP = 0
    ; socket remote Port = 0
   
    mov     eax, SOCKETBUFFSIZE * NUM_SOCKETS
    mov     ecx, NUM_SOCKETS
    
ss3:
    sub     eax, SOCKETBUFFSIZE

    movzx   ebx, word [edx + 22]     ; get destination port from the TCP hdr
    cmp     [eax + sockets + 12], bx ; compare with socket's local port
    jnz     nxttst3                        ; different - try next socket        

    mov     ebx, 0
    cmp     [eax + sockets + 20], bx ; only match a remote socket of 0
    jnz     nxttst3                        ; different - try next socket        

    mov     ebx, 0
    cmp     [eax + sockets + 16], ebx ; only match a socket remote IP of 0
    jnz     nxttst3                        ; different - try next socket        

    ; We have a complete match - use this socket
    jmp     tcprx_001

nxttst3:
    loop    ss3                     ; Return back if no match

    ; If we got here, we need to reject the packet
    inc     dword [dumped_rx_count]
    jmp     tcprx_exit
   
tcprx_001:   
    ; We have a valid socket/TCB, so call the TCB State Machine for that skt.
    ; socket is pointed to by [eax + sockets]
    ; IP packet is pointed to by [edx]
    ; IP buffer number is on stack ( it will be popped at the end)
    call    tcpStateMachine

tcprx_exit:    
    pop     eax
    call    freeBuff

    ret



;***************************************************************************
;   Function
;      buildTCPPacket
;
;   Description
;       builds an IP Packet with TCP data fully populated for transmission
;       You may destroy any and all registers
;          TCP control flags specified in bl
;          This TCB is in [sktAddr]
;          User data pointed to by esi
;       Data length in ecx
;          Transmit buffer number in eax
;
;***************************************************************************
buildTCPPacket:
    push    ecx                        ; Save data length
   
    ; convert buffer pointer eax to the absolute address
    mov     ecx, IPBUFFSIZE
    mul     ecx
    add     eax, IPbuffs

    mov     edx, eax

    mov     [edx + 33], bl            ; TCP flags
       
    mov     ebx, [sktAddr]
   
    ; So, ebx holds the socket ptr, edx holds the IPbuffer ptr
   
    ; Fill in the IP header ( some data is in the socket descriptor)
    mov     eax, [ebx + 8]
    mov     [edx + 12], eax      ; source IP
    mov     eax, [ebx + 16]
    mov     [edx + 16], eax      ; Destination IP
   
    mov     al, 0x45
    mov     [edx], al         ; Version, IHL
    xor     al, al   
    mov     [edx + 1], al     ; Type of service
   
    pop     eax                   ; Get the TCP data length
    push    eax
   
    add     eax, 20 + 20           ; add IP header and TCP header lengths
    mov     [edx + 2], ah
    mov     [edx + 3], al
    xor     al, al   
    mov     [edx + 4], al
    mov     [edx + 5], al
    mov     al, 0x40
    mov     [edx + 6], al
    xor     al, al  
    mov     [edx + 7], al
    mov     al, 0x20
    mov     [edx + 8], al
    mov     al, 6                         ; TCP protocol
    mov     [edx + 9], al

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品一区二区三区免费视频 | www.欧美.com| 亚洲一区二区偷拍精品| 欧美xxxxx裸体时装秀| 91在线免费看| 九色综合狠狠综合久久| 亚洲一区二区黄色| 中文字幕av一区二区三区高| 91精品国产综合久久福利| aaa欧美色吧激情视频| 黄一区二区三区| 日韩精品电影一区亚洲| 亚洲欧美一区二区在线观看| 26uuu国产在线精品一区二区| 欧美三级电影在线看| jiyouzz国产精品久久| 狠狠色丁香婷婷综合久久片| 视频一区视频二区中文字幕| 欧洲精品中文字幕| 国产精品18久久久久久久久 | 色综合夜色一区| 国产在线精品视频| 91丨九色丨蝌蚪丨老版| 久久精品噜噜噜成人88aⅴ| 又紧又大又爽精品一区二区| 国产精品久久久久久亚洲伦| 欧美成人r级一区二区三区| 欧美色视频在线观看| 91香蕉视频在线| 成人黄色免费短视频| 国产伦精品一区二区三区视频青涩 | 久久电影网电视剧免费观看| 亚洲一区二区高清| 亚洲摸摸操操av| 中文字幕欧美一| 国产精品热久久久久夜色精品三区 | 国产精品每日更新在线播放网址 | 一区二区三区免费看视频| 国产精品三级视频| 国产精品美女久久久久久| 久久欧美一区二区| 26uuu国产电影一区二区| 欧美成人a∨高清免费观看| 91精品国产综合久久精品图片 | 制服视频三区第一页精品| 色狠狠一区二区三区香蕉| 一本色道久久综合亚洲精品按摩| 99v久久综合狠狠综合久久| 成人免费观看视频| 成人污视频在线观看| 高清不卡在线观看| av在线不卡电影| 色综合天天综合| 在线观看亚洲精品视频| 欧美在线免费视屏| 欧美人伦禁忌dvd放荡欲情| 欧美性猛交xxxx黑人交| 欧美日韩国产免费一区二区| 欧美一区二区三区四区五区| 精品美女一区二区| 国产亚洲一区二区在线观看| 国产精品久久久一本精品| 中文字幕亚洲在| 亚洲一区二区三区美女| 婷婷开心激情综合| 久久99精品国产麻豆不卡| 国产成人日日夜夜| 91亚洲精品一区二区乱码| 欧美性一二三区| 日韩免费视频一区二区| 久久精品视频一区二区| 国产精品资源在线| 北条麻妃国产九九精品视频| 欧美在线一区二区三区| 日韩一区二区在线免费观看| 久久久久久久久久美女| 日韩毛片精品高清免费| 午夜精品久久久久久久99水蜜桃 | 国产日韩欧美麻豆| 国产精品不卡在线观看| 精品国产乱码久久久久久1区2区| 国产美女在线精品| 波多野结衣欧美| 欧美日韩亚洲综合在线| 日韩欧美成人一区| 亚洲欧洲精品一区二区三区 | 蜜桃av一区二区| 成人激情动漫在线观看| 欧美另类久久久品| 欧美国产亚洲另类动漫| 亚洲国产精品一区二区www | 粉嫩久久99精品久久久久久夜| 91网站最新网址| 欧美一区二区成人6969| 亚洲欧美一区二区视频| 久久国产精品99久久人人澡| 91蜜桃网址入口| 精品久久人人做人人爰| 亚洲激情在线播放| 国产成人av电影在线播放| 久久午夜电影网| 亚洲第一搞黄网站| 欧美在线一区二区| 美国av一区二区| 91片黄在线观看| 精品久久久久久久久久久院品网| 亚洲欧洲av另类| 精品一区二区在线播放| 在线观看av一区| 国产日韩欧美精品在线| 日精品一区二区三区| 色综合色狠狠天天综合色| 久久久久久日产精品| 午夜电影一区二区三区| 91免费在线播放| 国产亚洲短视频| 美女免费视频一区二区| 欧美三级日韩三级| 亚洲免费观看视频| 成人av网在线| 国产亚洲一区二区三区在线观看| 日本不卡一区二区三区| 欧美性大战久久久久久久蜜臀| 亚洲欧洲日产国码二区| 国产激情一区二区三区四区| 日韩欧美在线综合网| 视频一区在线播放| 欧美日韩在线观看一区二区| 亚洲黄色在线视频| 色综合久久天天综合网| 综合久久一区二区三区| 色呦呦日韩精品| 国产精品美女一区二区在线观看| 国产主播一区二区三区| 日韩视频一区二区三区| 日韩国产欧美在线观看| 欧美日韩美少妇| 五月开心婷婷久久| 在线播放91灌醉迷j高跟美女| 亚洲成va人在线观看| 欧美色网一区二区| 亚洲成a人v欧美综合天堂| 欧美日韩一区在线| 午夜精品久久久久久久| 欧美日本视频在线| 日韩高清在线电影| 日韩欧美国产高清| 国产一区二区三区四区在线观看| 精品对白一区国产伦| 国产精品亚洲专一区二区三区| 2021国产精品久久精品| 国内精品国产成人国产三级粉色| 精品国产一区二区三区av性色| 国产一区二区久久| 国产精品久久久久影院色老大| 99re视频精品| 亚洲综合在线电影| 欧美剧在线免费观看网站| 日韩精品国产欧美| 2023国产精品自拍| 成人国产亚洲欧美成人综合网 | 亚洲va天堂va国产va久| 欧美日韩高清不卡| 久久国产夜色精品鲁鲁99| 久久精品综合网| 91影院在线免费观看| 亚洲自拍欧美精品| 欧美一区二区成人6969| 国产经典欧美精品| 亚洲男人电影天堂| 这里是久久伊人| 成人在线一区二区三区| 一区二区三区四区亚洲| 欧美一区二区视频免费观看| 国产福利91精品一区二区三区| 一色桃子久久精品亚洲| 欧美日韩国产小视频在线观看| 久久精品久久综合| 中文字幕在线免费不卡| 欧美亚男人的天堂| 精品一区二区三区欧美| 国产精品久久夜| 91精品国产丝袜白色高跟鞋| 国产不卡视频一区| 亚洲一区二区三区四区的| 26uuu精品一区二区| 在线视频国产一区| 国产一区二区三区在线观看免费视频 | 色久优优欧美色久优优| 另类小说视频一区二区| 最新热久久免费视频| 欧美一级午夜免费电影| 成人97人人超碰人人99| 青青草国产成人99久久| 中文字幕在线一区免费| 91麻豆精品国产91久久久久久| av亚洲精华国产精华精| 老司机免费视频一区二区| 亚洲精品免费在线| 国产亚洲成年网址在线观看|